开发者

MySQL order by on varchar

开发者 https://www.devze.com 2023-01-04 02:27 出处:网络
In my table, there is a column called time. F开发者_Go百科ield type is varchar, value is like HH:MM , 02-25 ,21-42, 07-15

In my table, there is a column called time.

F开发者_Go百科ield type is varchar, value is like HH:MM , 02-25 ,21-42, 07-15

How to do the ordering by desc?


select * from table_name order by column_name DESC;

where,

table_name is name of table and 
column_name is name of column in the table (independent of whatever the data-type)

Note:-for proper o/p Your datatype for the time column should be datetime


The problem was fixed by:

ORDER BY CreationDate ASC,CreationTime DESC
0

精彩评论

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