select a,b from 表1 order by case a when 1 then 0 else 1 end,b asc
select a,b from 表1 order by case a when 1 then 0 else 1 end,b asc
select * from 表1 where a=1 order by b union all select * from 表1 where a<>1 order by b
create table #a( a int, b int) go insert into #a select 1, 340 union all select 0, 320 union all select 0, 210 union all select 1, 329 union all select 1, 403 union all select 0 , 322 go select * from #a order by a desc,b asc--drop table #a
union all
select * from 表1 where a<>1 order by b
a int,
b int)
go
insert into #a
select 1, 340
union all
select 0, 320
union all
select 0, 210
union all
select 1, 329
union all
select 1, 403
union all
select 0 , 322
go
select * from #a order by a desc,b asc--drop table #a