| От | Bruno Wolff III |
|---|---|
| Тема | Re: Making NULL entries appear first when ORDER BY |
| Дата | |
| Msg-id | 20050216044735.GA2343@wolff.to обсуждение исходный текст |
| Ответ на |
Making NULL entries appear first when ORDER BY |
| Ответы |
Re: Making NULL entries appear first when ORDER BY |
| Список | pgsql-sql |
> > 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? 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 IS NOT NULL ASC, start_time ASC; This assumes you want the NULL start times first within a particular date. Otherwise change the order in the ORDER BY clause.
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера