原文鏈接: https://stackoverflow.com/questions/11808573/sql-order-string-as-number
對某列數據進行排序的時候, 我希望他按照以下順序進行排序
1 2 3 4 5 6 7 8 9 10...
不過現在的順序如下:
1 10 2 3 4 5 6 7 8 9
解決方案:
將特定列名顯式轉換成int類型
select col from yourtable
order by cast(col as unsigned)