drop table tb;
create table tb(
areacode integer,
brndname varchar2(10),
result integer
)
insert into tb values(731,'全球通',10000);
insert into tb values(731,'神州行',50000);
insert into tb values(731,'动感地带',20000);
insert into tb values(732,'全球通',2000);
insert into tb values(732,'神州行',10000);
insert into tb values(732,'动感地带',3000);
select areacode 地区,
sum(case brndname when '动感地带' then result else 0 end) 动感地带,
sum(case brndname when '全球通' then result else 0 end) 全球通,
sum(case brndname when '神州行' then result else 0 end) 神州行
from tb
group by areacode;
就这样。