Re: order by

Поиск
Список
Период
Сортировка
От Mathieu Arnold
Тема Re: order by
Дата
Msg-id 1716030471.1021386536@andromede.reaumur.absolight.net
обсуждение исходный текст
Ответ на Re: order by  ("Joel Burton" <joel@joelburton.com>)
Список pgsql-sql

--On mardi 14 mai 2002 08:05 -0400 Joel Burton <joel@joelburton.com> wrote:

> You're asking to have it be sorted as {2,1,3}, but the sample result data
> you give seems to sort by {1,2,3}. Or am I misunderstanding your question?

you're right, I messed up my example :)
I'll buy the second solution, it's the easier to put on.

> 2) inlined in sql
>
>   SELECT * FROM a
>   ORDER BY CASE WHEN col3=2 THEN 1
>                 WHEN col3=1 THEN 2
>                 ELSE 3
>             END;

-- 
Mathieu Arnold


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

Предыдущее
От: "Frank Morton"
Дата:
Сообщение: sort text field numerically
Следующее
От: "Joel Burton"
Дата:
Сообщение: Re: date_part, how to use