Re: Nulls in timestamps

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Nulls in timestamps
Дата
Msg-id 20050715115924.GB11384@wolff.to
обсуждение исходный текст
Ответ на Re: Nulls in timestamps  (markMLl.pgsql-general@telemetry.co.uk)
Список pgsql-general
On Wed, Jul 13, 2005 at 18:15:12 +0000,
  markMLl.pgsql-general@telemetry.co.uk wrote:
> Many thanks Tom. Inconvenient from the point of view of the application but
> still useful information.
>
> The situation is that I've got a query with numerous subselects, each of which
> has to return exactly one row so I was doing a union with a nulled record then
> selecting the most recent: obviously I need to see bona-fide data if it's there.

you can order by datecol is null, datecol desc to get the most recent
non null date. For example:
area=> select day from (select 'today'::date as day union select 'tomorrow'::date as day union select null as day) as
unorder by day is null, day desc; 
    day
------------
 2005-07-16
 2005-07-15

(3 rows)


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: re my previous e-mail client-server example
Следующее
От: "Andrus"
Дата:
Сообщение: uncompressing pgAdmin backup file in windows