Re: Making NULL entries appear first when ORDER BY <field> ASC

From: Thomas F(dot)O'Connell <tfo(at)sitening(dot)com>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: PgSQL - SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Making NULL entries appear first when ORDER BY <field> ASC
Date: 2005-02-23 20:22:41
Message-ID: 6c309c4f2176e1b60b457e8dda777e1b@sitening.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)sitening(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2005-02-23 20:33:22 Re: Making NULL entries appear first when ORDER BY <field> ASC
Previous Message Ken Johanson 2005-02-23 20:12:39 Re: Making NULL entries appear first when ORDER BY <field>