Re: order by

Поиск
Список
Период
Сортировка
От D'Arcy J.M. Cain
Тема Re: order by
Дата
Msg-id 20020514120705.DE3E91C5D@druid.net
обсуждение исходный текст
Ответ на order by  (Mathieu Arnold <mat@mat.cc>)
Список pgsql-sql
On May 14, 2002 07:49 am, Mathieu Arnold wrote:
> table a (int, varchar, int)
>
> 1 | one   | 1
> 2 | two   | 3
> 3 | three | 2
> 4 | four  | 3
> 5 | five  | 2
>
> And I would like to select it and sort it so that the 3rd field is first 2,
> then 1 and then 3. so that the result should be :
>
> 1 | one   | 1
> 3 | three | 2
> 5 | five  | 2
> 2 | two   | 3
> 4 | four  | 3
>
> How could I do that ?

If I understand what you are asking:

SELECT c3, c2, c1 FROM a ORDER BY c3, c1;

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


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

Предыдущее
От: "Joel Burton"
Дата:
Сообщение: Re: order by
Следующее
От: juerg.rietmann@pup.ch
Дата:
Сообщение: date_part, how to use