On Thu, Feb 12, 2004 at 11:06:26 +0100,
  Fredrik Wendt <[EMAIL PROTECTED]> wrote:
> 
> The query to use would be,
>       
> SELECT ip.id FROM IPv4Address ip ORDER BY assignedAt ASC LIMIT 1;
> 
> with the exception that this returns rows with NULL at the end, instead
> of at the beginning which is what I'd like.
> 
> How do achieve this with one query? I'm using Postgres 7.4.

SELECT ip.id FROM IPv4Address ip ORDER BY assignedAt IS NULL,
  assignedAt ASC LIMIT 1;

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to