why · 2010-11-24 17:07:22 · 阅读: 356 我这样写的,基本上可以 select a , b1='D', c1=sum(case when b='D' then c end), b2='c' , c2=sum(case when b='c' then c end) from tb group by a