At 2:14 PM +0800 6/15/06, weetat wrote: >Hi all, > > I have SQL query , for example , Select country , name from tbl_chassis order by country. > > The problem of the sql statement is that , if there are empty value in country field , it be sorted first . > >How to do sorting the empty value last >? I can cp() function to do this ? or any mysql function to use? > >Thanks >- weetat >From mysql/null: <http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html> "If you want to have NULL values presented last when doing an ORDER BY, try this: SELECT * FROM my_table ORDER BY ISNULL(field), field [ ASC | DESC ] " You can also try other combinations, such as (I haven't tried it): SELECT country , name FROM tbl_chassis ORDER BY country AND IS NOT NULL tedd -- ------------------------------------------------------------------------------------ http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php