Re: ORDER BY 'DK', 'DE', DESC? - Mailing list pgsql-general

From Adam Ruth
Subject Re: ORDER BY 'DK', 'DE', DESC?
Date
Msg-id CAC8998B-AA87-11D8-9F90-000A959D1424@intercation.com
Whole thread Raw
In response to Re: ORDER BY 'DK', 'DE', DESC?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: ORDER BY 'DK', 'DE', DESC?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: ORDER BY 'DK', 'DE', DESC?  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
On May 20, 2004, at 11:20 AM, Stephan Szabo wrote:

> On Tue, 11 May 2004, [ISO-8859-1] Victor Spång Arthursson wrote:
>
>> Hi!
>>
>> I would like to know if it's possible to give a priority order of how
>> to sort the returning rows?
>>
>> Like for example to order every row with a field language = DK first,
>> then the rows with field language = *DE' and last the other languages,
>> ordered alphabetically…?
>
> Well, I think you can do something like:
>
> ORDER BY (language = 'DK'), (language = 'DE'), language
>
> (or you could possibly condense the first two into one with case)

Due to the sorting of boolean values, you'd need:

ORDER BY language = 'DK' desc, language like '%DE' desc, language;

>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: ORDER BY 'DK', 'DE', DESC?
Next
From: Stephan Szabo
Date:
Subject: Re: ORDER BY 'DK', 'DE', DESC?