Ajmal Posted September 7, 2009 Report Share Posted September 7, 2009 Hi. I have the Database table in which i set the date column also and now i want to fetch all the data order by Date.How to fetch data from database in order by Insertion Date and Time using mySql query.Thanks for your time. Link to comment Share on other sites More sharing options...
Synook Posted September 7, 2009 Report Share Posted September 7, 2009 Using the ORDER BY clause. http://www.w3schools.com/sql/sql_orderby.aspYou can have multiple ordering field, so if your date and time (for some reason) were stored in different fields you could do ... ORDER BY date, time Link to comment Share on other sites More sharing options...
Ajmal Posted September 7, 2009 Author Report Share Posted September 7, 2009 Using the ORDER BY clause. http://www.w3schools.com/sql/sql_orderby.aspYou can have multiple ordering field, so if your date and time (for some reason) were stored in different fields you could do... ORDER BY date, time Thanks Dear.But please tell me that how to fetch only the current month records. Means Fetch only one month records. Link to comment Share on other sites More sharing options...
Synook Posted September 7, 2009 Report Share Posted September 7, 2009 Use the WHERE clause. How are you storing your dates (UNIX timestamp, YYYYMMDD integer, DATETIME field)?http://www.w3schools.com/sql/sql_where.asp Link to comment Share on other sites More sharing options...
Ajmal Posted September 7, 2009 Author Report Share Posted September 7, 2009 I Used YYYYMMDD integer to store Date. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now