[snip] >> NW> Is there an easy way to order by date (YYYY - MM - DD), at the moment my >> NW> results are coming back with the *day* ordered but not the whole date >> NW> like this: >> >> NW> 02 02 2002 >> NW> 03 03 2005 >> NW> 18 02 2003 >> >> NW> See what I mean? >> [/snip]
If the date is in the format above you can select a substring +--------+------------+ | field1 | rDate | +--------+------------+ | 1 | 2002-03-01 | | 2 | 2002-03-03 | | 3 | 2002-03-05 | | 4 | 2002-03-07 | | 5 | 2002-03-11 | +--------+------------+ mysql> select substring_index(rDate, "-", -1) as Day -> from tblDate1 -> order by Day; +------+ | Day | +------+ | 01 | | 03 | | 05 | | 07 | | 11 | +------+ If you want to get fancy then you could CONCAT the whole date back together, with the day in the lead position, month in second, year in third. HTH! Jay --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php