X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9627052A6F for ; Wed, 9 Mar 2005 15:50:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56542-06 for ; Wed, 9 Mar 2005 15:50:17 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id D121E5646C for ; Wed, 9 Mar 2005 15:50:16 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1D93Ro-0001d3-00; Wed, 09 Mar 2005 10:50:08 -0500 To: Gary Stainburn Cc: pgsql-sql@postgresql.org Subject: Re: order by question References: <200503091241.55881.gary.stainburn@ringways.co.uk> <422EF4D2.4050103@archonet.com> <200503091406.11125.gary.stainburn@ringways.co.uk> In-Reply-To: <200503091406.11125.gary.stainburn@ringways.co.uk> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 09 Mar 2005 10:50:08 -0500 Message-ID: <87mztc7r9r.fsf@stark.xeocode.com> Lines: 21 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/153 X-Sequence-Number: 20632 Gary Stainburn writes: > > Alternatively: (a<>6),(a<>4),a > > Although this does exactly what I want, at first glance it should do > exactly the opposite. > > I'm guessing that for each line it evaluates > not (a=6) 0 for true else 1 Not really, "not a=6" is an expression that evaluates to a boolean, true or false. true sorts as "greater" than false. That order is counterintuitive but it's because the default sort order is ascending. So the "lesser" false records appear first. If you put "not a=6" in your select column list you'll see the true and false values appear. -- greg