Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DC3DE633F8A for ; Fri, 31 Jul 2009 08:37:28 -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 02948-02 for ; Fri, 31 Jul 2009 11:37:18 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id 648EC63388C for ; Fri, 31 Jul 2009 08:37:18 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MWqQE-00066X-CE for pgsql-sql@postgresql.org; Fri, 31 Jul 2009 11:37:14 +0000 Received: from srv.protecting.net ([212.126.218.242]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Jul 2009 11:37:14 +0000 Received: from hari.fuchs by srv.protecting.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Jul 2009 11:37:14 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Harald Fuchs Subject: Re: Show CAS, USD first; the left ordered by currency name Date: Fri, 31 Jul 2009 13:37:02 +0200 Lines: 34 Message-ID: References: <4A71F9CB.9050805@encs.concordia.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: srv.protecting.net X-Archive: encrypt User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:TbeODlMz7IOZWIUsv65bPW4IBrw= 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/160 X-Sequence-Number: 32901 In article <4A71F9CB.9050805@encs.concordia.ca>, Emi Lu 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.