Re: ORDER BY and null values

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: ORDER BY and null values
Дата
Msg-id 20020710154721.GA3981@wolff.to
обсуждение исходный текст
Ответ на ORDER BY and null values  (Paulo Jan <admin@digital.ddnet.es>)
Список pgsql-general
On Wed, Jul 10, 2002 at 14:04:32 +0200,
  Paulo Jan <admin@digital.ddnet.es> wrote:
> Hi all:
>
>     Sorry if this has been asked before. Just did a quick search in the
> archives and didn't find anything that was 100% relevant.
>     I have a table with a date field, where some of the rows are empty
> (with NULL values) and some aren't. I need to make a "SELECT <blah blah>
> ORDER BY date DESC" but my customer wants the rows with empty values to
> appear at the bottom of the result set, instead of at the top. Is this
> possible?

You can use expressions in order by, so it is possible to do. One option
is to use coalesce if there is something safe to map nulls to always
get the right ordering. There are other ways to make this work if you
don't have a bound on the dates.

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

Предыдущее
От: "Henrik Steffen"
Дата:
Сообщение: Re: Serious Crash last Friday
Следующее
От: "Henrik Steffen"
Дата:
Сообщение: Re: Serious Crash last Friday