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??? Quote Link to comment 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) Quote Link to comment Share on other sites More sharing options...
benji87 Posted March 28, 2007 Author Share Posted March 28, 2007 Yes it is yyyy-mm-dd Quote Link to comment Share on other sites More sharing options...
benji87 Posted March 28, 2007 Author Share Posted March 28, 2007 anyone??? Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 29, 2007 Share Posted March 29, 2007 SELECT * from tablename ORDER BY datefieldname ASC Quote Link to comment 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"; Quote Link to comment 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...... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.