create table scoreTable(name varchar2(20),score varchar2(20));
insert into scoreTable values('a','50');
insert into scoreTable values('a','60');
insert into scoreTable values('a','80');
insert into scoreTable values('b','90');
insert into scoreTable values('b','60');
insert into scoreTable values('b','50');
insert into scoreTable values('c','50');
insert into scoreTable values('c','100');
insert into scoreTable values('c','80');
select sum(decode(t.name,'a',t.score)) as a,
sum(decode(t.name,'b',t.score))as b,
sum(decode(t.name,'c',t.score))as c
from scoreTable t;
oracle行专列,求总值
最新推荐文章于 2021-04-11 22:42:11 发布