美文网首页
sql中的字符串转数字

sql中的字符串转数字

作者: 落寒z | 来源:发表于2018-03-14 10:19 被阅读73次

    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;
    
    1. 隐式转换 -"123"
    SELECT ordernum FROM OfficeworkMenu ORDER BY -ordernum desc;
    

    相关文章

      网友评论

          本文标题:sql中的字符串转数字

          本文链接:https://www.haomeiwen.com/subject/dynxqftx.html