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
回复已查看,多谢讲解,另外还是这个题目 (1) select * from t1 order 1 是按照第一列排序吧? (2) 那么select * from t1 order by case when a=5 then 1 else 0 end 这是将a=5是排到后面?难道不是当a=5时,按第一列排序? (3) 那么select a,b from c order by case when a=5 then 1800 else b end