Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一列 varchar 类型的列,其中存储了许多不同的数字。比如说看图
它应该短为
12-1
12-13
12-105
12-127
12-168
谢谢
1你可以试试这样的:
SELECT *, SUBSTRING_INDEX(row_name, '-', 1) as some_sort FROM table_name ORDER BY some_sort
所以我猜(未经测试,但以这种方式想法): 12-34,,,12-46...12-95等12-135
12-34
12-46
12-95
12-135
但是问题质量很低,所以我只能猜测你想做什么。