If I added a record yesterday and one today, how do I order the results by ‘select * from table_name’ by getting the entry added today first and then the older ones?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your primary key field is an auto-incremented integer, then you can do the following:
SELECT * FROM table_name ORDER BY pk_column DESCIf you’re not using an auto-incremented integer for your primary key, then you’ll need to do as Andre suggested and timestamp your rows.