simpjd Posted March 24, 2009 Share Posted March 24, 2009 In my sql database I have a list of dates stored as DD/MM/YY, I need a select statement that will order by date but this dosent work: "SELECT * FROM table ORDER BY date DESC" It orders them like this: 01/02/09 02/01/09 03/06/08 Please Help! Link to comment https://forums.phpfreaks.com/topic/150871-mysql-orderby-date-uk-help/ Share on other sites More sharing options...
simpjd Posted March 24, 2009 Author Share Posted March 24, 2009 P.S. Server version: 5.0.67-0ubuntu6 Link to comment https://forums.phpfreaks.com/topic/150871-mysql-orderby-date-uk-help/#findComment-792545 Share on other sites More sharing options...
PFMaBiSmAd Posted March 24, 2009 Share Posted March 24, 2009 That date format is not directly sortable because the yyyy mm dd fields are not arranged most significant (year) to least significant (day), which is why the DATE data type exists with a format of yyyy-mm-dd. You should be using a DATE data type to hold dates in a database. Link to comment https://forums.phpfreaks.com/topic/150871-mysql-orderby-date-uk-help/#findComment-792584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.