Re: [SQL] Making NULL entries appear first when ORDER BY ASC

2005-02-23 Thread Thomas F . O'Connell
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: O

Re: [SQL] Making NULL entries appear first when ORDER BY ASC

2005-02-23 Thread Bruno Wolff III
On Wed, Feb 23, 2005 at 13:54:50 -0600, "Thomas F.O'Connell" <[EMAIL PROTECTED]> 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 documen

Re: [SQL] Making NULL entries appear first when ORDER BY ASC

2005-02-23 Thread Thomas F.O'Connell
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. -tfo -- Thomas F. O'Connell Co-Founder, Information Architect S

Re: [SQL] Making NULL entries appear first when ORDER BY ASC

2005-02-16 Thread Andreas Joseph Krogh
On Wednesday 16 February 2005 04:47, Bruno Wolff III wrote: > > Now, as you see, touples with NULL in the "start_time"-field appear > > "after" the others. I would like to make all entries where start_time IS > > NULL apear *before* all the others. Any idea how to achieve this? > > SELECT start_dat

Re: [SQL] Making NULL entries appear first when ORDER BY ASC

2005-02-15 Thread Bruno Wolff III
> > Now, as you see, touples with NULL in the "start_time"-field appear "after" > the others. I would like to make all entries where start_time IS NULL apear > *before* all the others. Any idea how to achieve this? SELECT start_date, start_time, end_time, title FROM onp_crm_activity_log WHERE s

Re: [SQL] Making NULL entries appear first when ORDER BY ASC

2005-02-15 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Now, as you see, touples with NULL in the "start_time"-field > appear "after" the others. I would like to make all entries > where start_time IS NULL apear *before* all the others. ORDER BY start_date, CASE WHEN start_time IS NULL THEN 0 ELSE 1 E

Re: [SQL] Making NULL entries appear first when ORDER BY ASC

2005-02-15 Thread Rosser Schwarz
while you weren't looking, Andreas Joseph Krogh wrote: > Any idea how to achieve this? ... ORDER BY coalesce(start_date, '1900-01-01') ASC , coalesce(start_time, '1900-01-01') ASC; /rls -- :wq ---(end of broadcast)--- TIP 6: Have you searc

[SQL] Making NULL entries appear first when ORDER BY ASC

2005-02-15 Thread Andreas Joseph Krogh
Hi, I have the following table, with the query below to list entries from it where start_date IS NOT NULL: CREATE TABLE onp_crm_activity_log( id serial PRIMARY KEY, start_date timestamp, start_time timestamp, end_time timestamp, title varchar NOT NULL ); SELECT start_date, start_time, end_time,