Re: Show CAS, USD first; the left ordered by currency name - Mailing list pgsql-sql

From Harald Fuchs
Subject Re: Show CAS, USD first; the left ordered by currency name
Date
Msg-id pu1vnxkrs1.fsf@srv.protecting.net
Whole thread Raw
In response to Show CAS, USD first; the left ordered by currency name  (Emi Lu <emilu@encs.concordia.ca>)
Responses Re: Show CAS, USD first; the left ordered by currency name
List pgsql-sql
In article <4A71F9CB.9050805@encs.concordia.ca>,
Emi Lu <emilu@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.



pgsql-sql by date:

Previous
From: nha
Date:
Subject: Re: SELECT max(time) group by problem
Next
From: bricklen
Date:
Subject: Re: Show CAS, USD first; the left ordered by currency name