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;
结果: