日期:2014-05-17 浏览次数:20641 次
select vehicle,case vehicle when between 1 and 4 then 1
when between 5 and 18 then 2
when between 19 and 28 then 3 else 4 end as veh
from tb
create table #tab(vehicle int)
declare @i int
set @i=1
while @i<=28
begin
insert into #tab values(@i)
set @i=@i+1
end
alter table #tab add vehi int
update #tab set vehi=case when vehicle between 1 and 4 then 1
when vehicle between 5 and 18 then 2
when vehicle between 19 and 28 then 3 end
go
select * from #tab
drop table #tab
select vehicle,case when vehicle between 1 and 4 then 1
when vehicle between 5 and 18 then 2
when vehicle between 19 and 28 then 3 else 4 end as veh
from tb
select top 10 Col007,case when Col007 between 1 and 4 or Col007 in(21,22)then 1
when Col007 between 23 and 28 then 2
else 3 end as veh
from boutlist201201