22,209
社区成员
发帖
与我相关
我的任务
分享
Select * from 表 order by substring(1,charindex('-',编号)-1) asc,
substring(charindex('-',编号)+1,len(编号));
order by
cast(left(编号,charindex('-',编号)-1) as int),
cast(right(编号,len(编号)-charindex('-',编号)) as int)
---2楼正确 我掉了转换的一步
order by cast(left(编号,charindex('-',编号)-1) as int)
select * from tb order by cast(left(编号,charindex('-',编号)-1)as int)
order by cast(left(编号,charindex('-',编号)-1) as int)
order by left(编号,charindex('-',编号)+1)