发布网友 发布时间:2022-04-22 02:15
共2个回答
热心网友 时间:2022-04-08 04:11
select *
from sellrecord
order by convert(int,substring(listnumber,1,2)) asc,convert (int,substring(listnumber,4,len(listnumber)-2)) asc
热心网友 时间:2022-04-08 05:29
mysql> SELECT
-> ListNumber,
-> SUBSTRING_INDEX(ListNumber,'-',1) A,
-> SUBSTRING_INDEX(ListNumber,'-',-1) B
-> FROM
-> SellRecord
-> ORDER BY
-> CAST(SUBSTRING_INDEX(ListNumber,'-',1) as SIGNED),
-> CAST(SUBSTRING_INDEX(ListNumber,'-', -1) as SIGNED);
+------------+------+------+
| ListNumber | A | B |
+------------+------+------+
| 13-1 | 13 | 1 |
| 13-2 | 13 | 2 |
| 13-3 | 13 | 3 |
| 13-10 | 13 | 10 |
| 13-11 | 13 | 11 |
| 13-15 | 13 | 15 |
| 13-18 | 13 | 18 |
| 13-100 | 13 | 100 |
| 13-108 | 13 | 108 |
| 14-1 | 14 | 1 |
| 14-2 | 14 | 2 |
+------------+------+------+
11 rows in set (0.00 sec)
mysql>