34,576
社区成员
发帖
与我相关
我的任务
分享
if object_id('t1') is not null
drop table t1
go
create table t1(id int,a int,b int)
insert t1
select 1, 6, 2009 union all
select 2, 2, 2008 union all
select 3, 0, 2011 union all
select 4, 3, 2011 union all
select 5, 5, 2012 union all
select 6, 4, 2013
go
drop table t1
select *,newcol= case when a=5 then 1 else 0 end from t1 order by newcol