开发者

Order by date and time

开发者 https://www.devze.com 2023-01-12 14:24 出处:网络
I have two varchar fields which store the date and time in the following format: date=2010-08-18; time=07:53:55;

I have two varchar fields which store the date and time in the following format: date=2010-08-18; time=07:53:55;

What would be the right sql query to show m开发者_JAVA百科e the events from the most recent to the oldest


Aside from recommending that you use MySQL datetime fields rather than VARCHARs for any date or time values; what about something simple like adding an ORDER BY clause to your query:

ORDER BY `DATE` DESC, `TIME` DESC
0

精彩评论

暂无评论...
验证码 换一张
取 消