mysql中字符串类型的数字排序出错解决方法:cast(year as signed)

将字符串类型的数字转化为数字类型的数字就可以了,如下:

select 
    year,
    month
from table
order by 
    cast(year as signed), cast(month as signed) asc
发布了63 篇原创文章 · 获赞 10 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_30966497/article/details/104691090
今日推荐