From: Bruno Wolff III <bruno@wolff.to>
To: Fredrik Wendt <fredrik@csbnet.se>
Cc: pgsql-sql@postgresql.org
Subject: Re: ORDER BY TIMESTAMP_column ASC, NULL first
Date: Thu, 3 Jun 2004 12:31:01 -0500
Message-ID: <20040603173101.GA5022@wolff.to> (raw)
In-Reply-To: <20040212100626.GA21864@csbnet.se>
References: <20040212100626.GA21864@csbnet.se>
On Thu, Feb 12, 2004 at 11:06:26 +0100,
Fredrik Wendt <fredrik@csbnet.se> 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;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: bruno@wolff.to, fredrik@csbnet.se
Subject: Re: ORDER BY TIMESTAMP_column ASC, NULL first
In-Reply-To: <20040603173101.GA5022@wolff.to>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox