From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Paulo Jan <admin(at)digital(dot)ddnet(dot)es> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: ORDER BY and null values |
Date: | 2002-07-10 15:47:21 |
Message-ID: | 20020710154721.GA3981@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jul 10, 2002 at 14:04:32 +0200,
Paulo Jan <admin(at)digital(dot)ddnet(dot)es> wrote:
> Hi all:
>
> Sorry if this has been asked before. Just did a quick search in the
> archives and didn't find anything that was 100% relevant.
> I have a table with a date field, where some of the rows are empty
> (with NULL values) and some aren't. I need to make a "SELECT <blah blah>
> ORDER BY date DESC" but my customer wants the rows with empty values to
> appear at the bottom of the result set, instead of at the top. Is this
> possible?
You can use expressions in order by, so it is possible to do. One option
is to use coalesce if there is something safe to map nulls to always
get the right ordering. There are other ways to make this work if you
don't have a bound on the dates.
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2002-07-10 15:48:21 | Re: (A) native Windows port |
Previous Message | Henrik Steffen | 2002-07-10 15:46:35 | Re: Serious Crash last Friday |