Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 11277635B26 for ; Thu, 30 Jul 2009 17:06:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 49353-03-7 for ; Thu, 30 Jul 2009 20:06:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f206.google.com (mail-ew0-f206.google.com [209.85.219.206]) by mail.postgresql.org (Postfix) with ESMTP id 05B64634D93 for ; Thu, 30 Jul 2009 17:06:07 -0300 (ADT) Received: by mail-ew0-f206.google.com with SMTP id 2so1051320ewy.19 for ; Thu, 30 Jul 2009 13:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:cc :content-type; bh=AbiP23p1w7JEoKLOD7DkGydtFGSYgTCrn0G8sJsam88=; b=U5BURLJ8vz9p4RY3DcHlSKqpjdlNYgQQGbfz77cRYtHTvahgN+7Xu5i/ZkKqcTv1pD Wms5F9OQ/48slAUQBWTybz/UyvVtz0QlHdj9BJOX/cXM8NJJNabiUmhOSGzcJJ3ETHxX c8f9sss47l8i7i9jIQbPL/Cykky4m0JZTlrpw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:cc:content-type; b=eSO50PuNhUsNdaH3KloDEGco/r9qkjdP0XSuIB3xIoX5z84u9iFXxNCwZVJd6LuKZd Ycih9ZnQlxBRYmjH5z81NcHwgpWM90+5Lj8lFIS68SCf4b4N+fpDz5OdVK27lzibrfRr gzlirK1t9SbpZPTu5kZB1IcqpnT18O7Fk2KDU= MIME-Version: 1.0 Received: by 10.210.63.2 with SMTP id l2mr1940943eba.69.1248984366899; Thu, 30 Jul 2009 13:06:06 -0700 (PDT) In-Reply-To: <4A71F9CB.9050805@encs.concordia.ca> References: <4A71F9CB.9050805@encs.concordia.ca> Date: Thu, 30 Jul 2009 23:06:06 +0300 X-Google-Sender-Auth: 4a147a9b80ad000d Message-ID: Subject: Re: Show CAS, USD first; the left ordered by currency name From: sergey kapustin Cc: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=0015174c3e8884e529046ff1d5e1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.582 tagged_above=-10 required=5 tests=HTML_MESSAGE=0.001, MISSING_HEADERS=1.581 X-Spam-Level: * X-Archive-Number: 200907/158 X-Sequence-Number: 32899 --0015174c3e8884e529046ff1d5e1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit ...order by currency not in('USD', 'AND', 'CAD'); this condition will be avaluated as FALSE for USD, AND and CAD, and as TRUE for all other currencies. When the records are sorted the "false" are placed on the top because false wrote: > 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 > ... > > > Thanks a lot! > -- > Lu Ying > > > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > --0015174c3e8884e529046ff1d5e1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
...order by currency not in('USD', 'AND', = 'CAD');

this condition will be avaluated as FALSE for USD, AND and CAD, and as TRUE for all other currencies. When the records are sorted the "false" are pla= ced on the top because false<true;.

On Thu, J= ul 30, 2009 at 10:51 PM, Emi Lu <emilu@encs.concordia.ca> wrote:
Good morning,

I have a currency table (code, description).

Example values:
=A0ADF | Andorran Franc
=A0... ...
=A0ANG | NL Antillian Guilder
=A0AON | Angolan New Kwanza
=A0AUD | Australian Dollar
=A0AWG | Aruban Florin
=A0BBD | Barbados Dollar
=A0USD | US Dollar
=A0CAD | Canadian Dollar

Is there a way I can query to display USD AND CAD first, while other rows a= re ordered by Code.

For example,

CAS | Canadian Dollar
USD | US Dollar
ADF | Andorran Franc
...


Thanks a lot!
--
Lu Ying



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

--0015174c3e8884e529046ff1d5e1--