Re: Making NULL entries appear first when ORDER BY
От | Ragnar Hafstað |
---|---|
Тема | Re: Making NULL entries appear first when ORDER BY |
Дата | |
Msg-id | 1108521073.28180.5.camel@localhost.localdomain обсуждение исходный текст |
Ответ на |
Making NULL entries appear first when ORDER BY |
Список | pgsql-sql |
On Wed, 2005-02-16 at 00:55 +0000, Andreas Joseph Krogh wrote: > SELECT start_date, start_time, end_time, title > FROM onp_crm_activity_log > WHERE start_date IS NOT NULL > ORDER BY start_date ASC, start_time ASC; > > start_date | start_time | end_time | title > ---------------------+---------------------+---------------------+----------- > 2005-02-03 00:00:00 | 2005-02-03 08:00:00 | | Something > 2005-02-03 00:00:00 | 2005-02-03 09:00:00 | 2005-02-03 12:00:00 | Something > 2005-02-03 00:00:00 | | | Something > > > Now, as you see, touples with NULL in the "start_time"-field appear "after" > the others. I would like to make all entries where start_time IS NULL apear > *before* all the others. Any idea how to achieve this? how about ORDER BY start_date , COALESCE(start_time,'0001-01-01 00:00:00'::timestamp) ? gnari
В списке pgsql-sql по дате отправления: