Re: order by <something wierd>

From: Mathieu Arnold <mat(at)mat(dot)cc>
To: Joel Burton <joel(at)joelburton(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: order by <something wierd>
Date: 2002-05-14 12:28:57
Message-ID: 1716030471.1021386536@andromede.reaumur.absolight.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--On mardi 14 mai 2002 08:05 -0400 Joel Burton <joel(at)joelburton(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Joel Burton 2002-05-14 12:43:19 Re: sort text field numerically
Previous Message Joel Burton 2002-05-14 12:27:12 Re: date_part, how to use