1

I want to fetch data a SQL table with ASC order. But, the Columns has values like

Route 1
Route 2
Route 3
Route 10
Route 11 etc. 

So, when I use ORDER BY ASC, it will arrange as

Route 1
Route 10
Route 11
Route 2
Route 3 etc.

How to solve this problem ?

4

1 回答 1

0

在 SQLite 中,提取子字符串并将其转换为数字的语法是:

SELECT * FROM MyTable ORDER BY CAST(substr(MyColumn, 7) AS INT)
于 2013-11-13T08:59:11.513 回答