Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Order by datetime mysql

I have a table that contains a datetime field type, and I want to sort the select syntax depends on it descending, just like the following:

2012-12-12 01:44:20

2012-12-11 01:44:40

2012-12-10 01:40:36

2012-12-09 12:28:19

2012-12-09 12:19:21

2012-12-09 12:11:50

2012-12-09 12:00:11

2012-12-09 11:59:26

2012-12-09 11:57:08

2012-12-09 11:55:21

like image 451
Samer Avatar asked Dec 16 '12 08:12

Samer


1 Answers

ORDER BY columnname DESC

Ta-dah!

like image 185
zerkms Avatar answered Sep 30 '22 23:09

zerkms