Re: order by - Mailing list pgsql-sql

From Mathieu Arnold
Subject Re: order by
Date
Msg-id 1716030471.1021386536@andromede.reaumur.absolight.net
Whole thread Raw
In response to Re: order by  ("Joel Burton" <joel@joelburton.com>)
List 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 by date:

Previous
From: "Frank Morton"
Date:
Subject: sort text field numerically
Next
From: "Joel Burton"
Date:
Subject: Re: date_part, how to use