> -----Original Message-----
> From: Michael Stassen [mailto:[EMAIL PROTECTED] 
> Sent: 13 July 2005 13:38
> To: Scott Hamm
> Cc: 'Mysql '
> Subject: Re: Null & alphabetic order
> 
> Scott Hamm wrote:
> 
> > How do I use ORDER BY in a way that it list null last after 
> Z instead 
> > of before A?
> > 
> > I.e. instead of:
> > 
> > Null, A, B, C....
> > 
> > result would be:
> > 
> > X, Y, Z, null
> > 
> > How can I get around to that?
> 
> Something like
> 
>    ORDER BY IF(col IS NULL, 1, 0), col
> 
> Michael
> 

Or simply:

ORDER BY col IS NULL, col

Which will probably be *slightly* faster..

Mark

Mark Leith
Cool-Tools UK Limited
http://www.cool-tools.co.uk

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.13/47 - Release Date: 12/07/2005
 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to