select t.id,sum(decode(t.shengfu,'胜',1,0)) 胜,sum(decode(t.shengfu,'负',1,0)) 负 from test2 t group by t.id