sql语句中字符串转数字的几种方式-----升序方式排列
1.CAST(ordernum AS SIGNED integer)
SELECT ordernum FROM OfficeMenu ORDER BY CAST(ordernum AS SIGNED integer) asc;
2.CAST(ordernum AS SIGNED)
SELECT ordernum FROM OfficeMenu ORDER BY CAST(ordernum AS SIGNED) asc;
3."123"+0
SELECT ordernum FROM OfficeMenu ORDER BY ordernum+0 asc;
- 隐式转换 -"123"
SELECT ordernum FROM OfficeworkMenu ORDER BY -ordernum desc;
网友评论