这个怎么排序啊?
有这么一列
a
1-1-18-1
1-1-2-1
1-1-2-1应该排在1-1-18-1前面
[解决办法]
;with tb(col) as
(
select '1-1-18-1'
union all select '1-1-2-1'
)
select col
from
(
select COL,rn=cast(REPLACE(col,'-','') as int) from tb
)t
order by rn
/*
col
----------------------
1-1-2-1
1-1-18-1
*/