Re: order by <something wierd>

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: Mathieu Arnold <mat(at)mat(dot)cc>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: order by <something wierd>
Date: 2002-05-14 12:07:05
Message-ID: 20020514120705.DE3E91C5D@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at){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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Frank Morton 2002-05-14 12:23:53 sort text field numerically
Previous Message Joel Burton 2002-05-14 12:05:08 Re: order by <something wierd>