Order by date (varchar)?

前端 未结 4 786
隐瞒了意图╮
隐瞒了意图╮ 2020-12-06 21:25

I want to order by date.

e.g.

table_date
February 2011
January 2011
December 2010

I\'ve already tried:

SELECT disti         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 22:08

    If you must store the dates in a varchar which as others pointed out is not recommended, you could use:

    SELECT table_date FROM tables ORDER BY STR_TO_DATE(table_date, '%M %Y') DESC;
    

提交回复
热议问题