dimanche 27 avril 2014

MySQL : Sorting the result based on a column containing dates as a string


Vote count:

0




I have a column that contains dates in the form of strings. What I want is to order by the "dates" stored in that string column. I have tried with the following:



SELECT col1, col2, col3, vrdate
FROM table1
ORDER BY Date(vrdate);


And



SELECT col1, col2, col3, vrdate
FROM table1
ORDER BY CAST(vrdate AS DATE);


But none of the above works. Is there any way that I can sort the result returned by the above query based on the dates stored in vrdate column while not considering them as strings?



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire