From: Greg Stark <gsstark@mit.edu>
To: Gary Stainburn <gary.stainburn@ringways.co.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: order by question
Date: 09 Mar 2005 10:50:08 -0500
Message-ID: <87mztc7r9r.fsf@stark.xeocode.com> (raw)
In-Reply-To: <200503091406.11125.gary.stainburn@ringways.co.uk>
References: <200503091241.55881.gary.stainburn@ringways.co.uk>
<422EF4D2.4050103@archonet.com>
<200503091406.11125.gary.stainburn@ringways.co.uk>
Gary Stainburn <gary.stainburn@ringways.co.uk> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gsstark@mit.edu, gary.stainburn@ringways.co.uk
Subject: Re: order by question
In-Reply-To: <87mztc7r9r.fsf@stark.xeocode.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox