一個關於MySQL字符串排序,在數據里面定義的是varchar類型,實際存放的是Int類型的數據,按一下查詢語句進行排序:
將字段*1或者+0可以將MySQL字符串字段按數值排序
如:
1 select * from table where 1 order by id*1 desc;
或者
1 select * from table where 1 order by id+0 desc;
除了上述方法外,這里附上一種排序方法,利用find_in_set()進行無敵排序
MySQL常用函數列表
參考鏈接:https://blog.csdn.net/weixin_40607363/article/details/81776951
