日期:2014-05-18 浏览次数:20604 次
select
a,
[1]=max(case b when 1 then 1 end),
[2]=max(case b when 2 then 2 end),
[3]=max(case b when 3 then 3 end),
[4]=max(case b when 4 then 4 end)
from
tab1 inner join tab2
on
tab1.c=tab2.c
where
b=1 or b=2 or b=3
group by
a