Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4F7A9631870 for ; Fri, 31 Jul 2009 10:28:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 16236-08 for ; Fri, 31 Jul 2009 13:27:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by mail.postgresql.org (Postfix) with ESMTP id CFE8F632D1A for ; Fri, 31 Jul 2009 10:27:51 -0300 (ADT) Received: by qw-out-2122.google.com with SMTP id 3so1008299qwe.61 for ; Fri, 31 Jul 2009 06:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6gLwXram9BRq9zMl+TQCsj3dTUdz/DIgqZdd3xh/kv4=; b=cWW0Fls5Ul/lFYAMW5M1oesmDcL+r7PL1dhYGTDL/GUeDE4FCpzbVCT9h/V56BPdP1 AZxgBMzmmvEZnp/BCgzrFEiq9Sf6e3Cyjb4qfKVItAVEF7QTZsUAo6/PX8+B170itRXg YC6/BcbsmYoY2hw1S1uOhp97buNzvm+ovxixg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=d8OSHZZMZBr/KkRJyxQa8XCAETegPrykKrPg3yhdG9Ndx7Eak9aIHf7N25Z9dXrrCH YN+ECEMJFThXTnveVVHvHY1Eo9oUU4xXg3AccXnAo7U1vZGbW2QSXr36WWNX6T8RxEBf 7urAekRp4MoitBX0WiuT2Nia22RYDvb7L7jdk= MIME-Version: 1.0 Received: by 10.229.99.69 with SMTP id t5mr446793qcn.30.1249046870300; Fri, 31 Jul 2009 06:27:50 -0700 (PDT) In-Reply-To: References: <4A71F9CB.9050805@encs.concordia.ca> Date: Fri, 31 Jul 2009 06:27:50 -0700 Message-ID: <33b743250907310627o637c1001v8e1a89060e053d76@mail.gmail.com> Subject: Re: Show CAS, USD first; the left ordered by currency name From: bricklen To: emilu@encs.concordia.ca Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-10 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/161 X-Sequence-Number: 32902 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 wrote: > In article <4A71F9CB.9050805@encs.concordia.ca>, > Emi Lu writes: > >> Good morning, >> I have a currency table (code, description). > >> Example values: >> =C2=A0ADF | Andorran Franc >> =C2=A0... ... >> =C2=A0ANG | NL Antillian Guilder >> =C2=A0AON | Angolan New Kwanza >> =C2=A0AUD | Australian Dollar >> =C2=A0AWG | Aruban Florin >> =C2=A0BBD | Barbados Dollar >> =C2=A0USD | US Dollar >> =C2=A0CAD | 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 > > =C2=A0SELECT code, description > =C2=A0FROM currency > =C2=A0ORDER BY code !=3D 'CAD', code !=3D 'USD', code; > > BTW: your data are obsolete. =C2=A0Andorra 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 >