MySQL on order on varchar

时间:2010-06-18 07:25:28

标签: mysql

在我的表中,有一个名为time的列。

字段类型为varchar,值类似于HH:MM,02-25,21-42,07-15

如何通过desc进行排序?

2 个答案:

答案 0 :(得分:1)

select * from table_name order by column_name DESC;

其中,

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

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

答案 1 :(得分:0)

问题由以下方法解决:

ORDER BY CreationDate ASC,CreationTime DESC