62,267
社区成员
发帖
与我相关
我的任务
分享
Create table #t(name varchar(10),age int,state varchar(10))
insert #t select '小明',26,'丙' union all
select '小黄',24,'乙' union all
select '小青',22,'甲' union all
select '小龙',34,'乙' union all
select '小张',26,'甲' union all
select '小玉',35,'丙'
select * from #t
select name,age,state,sort=case state when '甲' then 1 when '乙' then 2 when '丙' then 3 else 4 end from #t order by sort asc
drop table #t