简体   繁体   中英

Mysql Ordering by date

I have a date field in my table called date1. if i use the following query.

 select * from schedule order by date1 asc

 it gives the result like as jan 2011 comes before december 2010. but i need the december 2011 as the first row of the result. 

Change your query to

SELECT * FROM schedule ORDER BY date1 DESC

This should do the trick.

James

select * from schedule order by date1 desc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM