select sno,
nvl(to_char(sum(decode(cno,'c001',score))),'-') c001,
nvl(to_char(sum(decode(cno,'c002',score))),'-') c002,
nvl(to_char(sum(decode(cno,'c003',score))),'-') c003,avg(score) 平均分,sum(score) 总成绩
from sc
group by sno;
结果:
2022-11-20 12:53:12
select sno,
nvl(to_char(sum(decode(cno,'c001',score))),'-') c001,
nvl(to_char(sum(decode(cno,'c002',score))),'-') c002,
nvl(to_char(sum(decode(cno,'c003',score))),'-') c003,avg(score) 平均分,sum(score) 总成绩
from sc
group by sno;
结果: