【MySQL】【2】数字排序问题
--我用的方案 SELECT * FROM TABLE_Q ORDER BY CAST(ID AS SIGNED) ASC
备注:
不做特殊处理的话,数字位数不一样时排序有问题,比如10会比2小。
其他方案:
--1 SELECT * FROM TABLE_Q ORDER BY ID + 0 ASC; --2 SELECT * FROM TABLE_Q ORDER BY CONVERT(ID AS SIGNED) ASC;
参考博客:
1,Mysql中数字排序问题 - 陈袁的博客 - CSDN博客
https://blog.csdn.net/achenyuan/article/details/79785817