查下行转列select a, decode(sum(case when b = 'm' then c else 0),0,null,sum(case when b = 'm' then c else 0)) m, decode(sum(case when b = 'n' then c else 0),0,null,sum(case when b = 'n' then c else 0)) n, decode(sum(case when b = 'p' then c else 0),0,null,sum(case when b = 'p' then c else 0)) p from A group by a;
select a, sum(decode(b, 'm', c, 0)) m, sum(decode(b, 'n', c, 0)) n, sum(decode(b, 'p', c, 0)) p from a group by a
decode(sum(case when b = 'm' then c else 0),0,null,sum(case when b = 'm' then c else 0)) m,
decode(sum(case when b = 'n' then c else 0),0,null,sum(case when b = 'n' then c else 0)) n,
decode(sum(case when b = 'p' then c else 0),0,null,sum(case when b = 'p' then c else 0)) p
from A
group by a;