benji87 Posted March 28, 2007 Share Posted March 28, 2007 Hey all im trying to sort a fixtures list by date! But obviously it just sorts it by first numbers for example it orders the list by day value and not day and month, i found this code in a previous post SELECT DATE_FORMAT(date_field, '%W %M %Y') FROM table_name Trouble is i dont really understand. How do i implement that if i want to select all from the table and order it by the date??? Link to comment https://forums.phpfreaks.com/topic/44621-sorting-by-date/ Share on other sites More sharing options...
AndyB Posted March 28, 2007 Share Posted March 28, 2007 What is the exact format of the date information in your database table (oh, please let's hope it's yyyy-mm-dd) Link to comment https://forums.phpfreaks.com/topic/44621-sorting-by-date/#findComment-216690 Share on other sites More sharing options...
benji87 Posted March 28, 2007 Author Share Posted March 28, 2007 Yes it is yyyy-mm-dd Link to comment https://forums.phpfreaks.com/topic/44621-sorting-by-date/#findComment-216705 Share on other sites More sharing options...
benji87 Posted March 28, 2007 Author Share Posted March 28, 2007 anyone??? Link to comment https://forums.phpfreaks.com/topic/44621-sorting-by-date/#findComment-216816 Share on other sites More sharing options...
AndyB Posted March 29, 2007 Share Posted March 29, 2007 SELECT * from tablename ORDER BY datefieldname ASC Link to comment https://forums.phpfreaks.com/topic/44621-sorting-by-date/#findComment-217352 Share on other sites More sharing options...
DeathStar Posted March 29, 2007 Share Posted March 29, 2007 and limit to 100 is: SELECT * from tablename ORDER BY datefieldname ASC LIMIT 100 or to let user dicide: $ord = "asc"; $limit = "100"; Link to comment https://forums.phpfreaks.com/topic/44621-sorting-by-date/#findComment-217357 Share on other sites More sharing options...
benji87 Posted March 30, 2007 Author Share Posted March 30, 2007 Ok those are pretty simpe queries and is what i already have. That wont output the date correctly as at the moment in the table its in YYYY-MM-DD format and that wont order it by the months just the number...... Link to comment https://forums.phpfreaks.com/topic/44621-sorting-by-date/#findComment-217984 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.