Re: order by <something wierd>

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: mat(at)mat(dot)cc (Mathieu Arnold)
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: order by <something wierd>
Date: 2002-05-14 13:58:23
Message-ID: 200205141158.NAA00136@rodos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Try
select * from a order by 3,1,2;
Regards, Christoph
>
> Hi
>
> I have :
>
> 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 ?
>
> --
> Mathieu Arnold
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mathieu Arnold 2002-05-14 16:13:09 aggregate...
Previous Message Joel Burton 2002-05-14 12:43:19 Re: sort text field numerically