Bharanikumar
Bharanikumar

Reputation: 25733

MySQL order by on varchar

In my table, there is a column called time.

Field type is varchar, value is like HH:MM , 02-25 ,21-42, 07-15

How to do the ordering by desc?

Upvotes: 0

Views: 303

Answers (2)

Bharanikumar
Bharanikumar

Reputation: 25733

The problem was fixed by:

ORDER BY CreationDate ASC,CreationTime DESC

Upvotes: 0

Salil
Salil

Reputation: 47472

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

Upvotes: 1

Related Questions