From: Thomas F.O'Connell <tfo@sitening.com>
To: Bruno Wolff III <bruno@wolff.to>
Cc: PgSQL - SQL <pgsql-sql@postgresql.org>
Subject: Re: Making NULL entries appear first when ORDER BY <field> ASC
Date: Wed, 23 Feb 2005 14:22:41 -0600
Message-ID: <6c309c4f2176e1b60b457e8dda777e1b@sitening.com> (raw)
In-Reply-To: <20050223203322.GA21904@wolff.to>
References: <200502160055.59288.andreak@officenet.no>
<20050216044735.GA2343@wolff.to>
<200502160939.27431.andreak@officenet.no>
<b27f2f6549c676ab0afe3b615e905230@sitening.com>
<20050223203322.GA21904@wolff.to>
Yup. Got it. Wasn't thinking clearly about what expression meant.
Thanks!
-tfo
--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005
On Feb 23, 2005, at 2:33 PM, Bruno Wolff III wrote:
> On Wed, Feb 23, 2005 at 13:54:50 -0600,
> "Thomas F.O'Connell" <tfo@sitening.com> wrote:
>> How would one know from the reference material that it is possible to
>> include IS NOT NULL in an ORDER BY clause?
>>
>> Similarly, other than the FAQ, I've never been able to tell from the
>> SELECT documentation why ORDER BY random() works.
>
> From the SELECT command documentation:
> SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
> * | expression [ AS output_name ] [, ...]
> [ FROM from_item [, ...] ]
> [ WHERE condition ]
> [ GROUP BY expression [, ...] ]
> [ HAVING condition [, ...] ]
> [ { UNION | INTERSECT | EXCEPT } [ ALL ] select ]
> [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
> [ LIMIT { count | ALL } ]
> [ OFFSET start ]
> [ FOR UPDATE [ OF table_name [, ...] ] ]
>
> Notice that for ORDER BY you can supply an expression. That should be
> a big
> clue why you can use IS NOT NULL and random() in an ORDER BY clause.
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: tfo@sitening.com, bruno@wolff.to
Subject: Re: Making NULL entries appear first when ORDER BY <field> ASC
In-Reply-To: <6c309c4f2176e1b60b457e8dda777e1b@sitening.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