Re: Problem of Null Ordering - Mailing list pgsql-general

From Dennis Björklund
Subject Re: Problem of Null Ordering
Date
Msg-id Pine.LNX.4.44.0212031028380.9578-100000@zigo.dhs.org
Whole thread Raw
In response to Problem of Null Ordering  (Harry Yau <harry.yau@regaltronic.com>)
List pgsql-general
On Tue, 3 Dec 2002, Harry Yau wrote:

> NULL will come after the row that have a number value. I am wondering is
> there anything I can do to make the row with Null value come before the
> row with a number value.

I don't know of such a setting. I have however a workaround that you can
apply to the order by clause. If b is the column that contains NULL values
that you want to order by, then you can instead order in this way:

ORDER BY b IS NULL DESC, b

(or ORDER BY b IS NOT NULL, b)

which will give you the NULL values first. It's probably not standard SQL.

ps. Why post to several lists?

--
/Dennis


pgsql-general by date:

Previous
From: Jean-Christian Imbeault
Date:
Subject: Re: Problem of Null Ordering
Next
From: Harry Yau
Date:
Subject: Re: Problem of Null Ordering