将13-1,13-2,13-10,13-11,13-100,13-101,13-108,13-110,14-1,14-2.
排成14-2,14-1,13-110,13-108,13-101,13-100,13-11,13-10,13-2,13-1.
(假设数据储存在ss表dyn列)
select dyn as 排序后
from ss
order by convert(int ,left(dyn,2)) desc,
convert (int ,right(dyn,len(dyn)-3)) desc
为什么总是得不到想要的结果?
------解决方案--------------------------------------------------------
order by convert(int ,left(dyn,2)) desc,
convert (int ,right(rtrim(dyn),len(rtrim(dyn))-3)) desc