> But if I change the output format with: DATE_FORMAT(data,'%d-%m-%Y'), > the order by clause attempt to order the new format > incorrectly, because > I've an output like this: 12-2-2002, 12-3-2002, 12-4-2002, > and 13-2-2002!!!
I normally do this: SELECT DATE_FORMAT(datefield,'%d-%m-%Y') as datefield FROM table ORDER BY table.datefield This forces mysql to order by the data in the table instead of the result 'datefield' (note the same name of both the field and the result). :wq //andreas http://phpwizard.dk --------------------------------------------------------------------- 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