【问题标题】:SQLite Ordering Whole NumbersSQLite 排序整数
【发布时间】:2020-05-28 18:14:07
【问题描述】:

我很清楚 SQLite 中的 ORDER BY 会将数字按升序排列,除非 DESC 位于末尾。但我意识到它只适用于起始数字。

i.e 
INT
14
78
357
2999
57
888

ORDER BY INT

Gives
14
2999
357
57
78
888

是否可以使用 ORDER BY 函数,其中整数按升序排列?

As such
14
57
78
357    
888
2999

【问题讨论】:

标签: sqlite


【解决方案1】:
select (INT * 1)  as "int_number" from mytable order by 1

或者正如有人在链接中指出的那样:

select INT from mytable order by (cast INT as Integer)

【讨论】:

    猜你喜欢
    • 2016-01-08
    • 2014-11-20
    • 2010-12-26
    • 2017-12-14
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多