Re: ORDER BY TIMESTAMP_column ASC, NULL first

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: ORDER BY TIMESTAMP_column ASC, NULL first
Дата
Msg-id 20040603173101.GA5022@wolff.to
обсуждение исходный текст
Ответ на ORDER BY TIMESTAMP_column ASC, NULL first  (Fredrik Wendt <fredrik@csbnet.se>)
Список pgsql-sql
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;


В списке pgsql-sql по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Reference with condition on other table column?
Следующее
От: Joseph Turner
Дата:
Сообщение: Selecting "sample" data from large tables.