Alternatively,

...
ORDER BY (case when code in ('USD','CAD') then 0 else 1 end),code

On Fri, Jul 31, 2009 at 4:37 AM, Harald Fuchs<hari.fu...@gmail.com> wrote:
> In article <4a71f9cb.9050...@encs.concordia.ca>,
> Emi Lu <em...@encs.concordia.ca> writes:
>
>> Good morning,
>> I have a currency table (code, description).
>
>> Example values:
>>  ADF | Andorran Franc
>>  ... ...
>>  ANG | NL Antillian Guilder
>>  AON | Angolan New Kwanza
>>  AUD | Australian Dollar
>>  AWG | Aruban Florin
>>  BBD | Barbados Dollar
>>  USD | US Dollar
>>  CAD | Canadian Dollar
>
>> Is there a way I can query to display USD AND CAD first, while other
>> rows are ordered by Code.
>
>> For example,
>
>> CAS | Canadian Dollar
>> USD | US Dollar
>> ADF | Andorran Franc
>> ...
>
> Probably the shortest solution is
>
>  SELECT code, description
>  FROM currency
>  ORDER BY code != 'CAD', code != 'USD', code;
>
> BTW: your data are obsolete.  Andorra has the Euro.
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to