db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <mail...@numerixtechnology.de>
Subject [psql] ORDER BY <column> IS NOT NULL
Date Sun, 19 Sep 2004 16:22:26 GMT
Hello,

In PostGreSQL NULL values sort last. The following SQL statement will
sort them at the top:

SELECT * FROM <table> ORDER BY <col> IS NOT NULL, ORDER BY <col> ASC

or alternatively

SELECT * FROM <table> ORDER BY COALASCE(<col>,0) ASC
In this example NULLs are mapped to zero, i.e. one would choose the 
lowest possible value.


Result

<col>
-------------
NULL
12
13
16
18

How can this be done via Torque Criteria?

-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message