求写出SQL查询oracle数据库学生表里的每个班级每个课程的总成绩
发布网友
发布时间:2022-05-01 02:38
我来回答
共1个回答
热心网友
时间:2022-04-15 02:40
select course as '成绩总和',
sum(case when class = 'JSD1701' then score else 0 end) as 'jsd1701',
sum(case when class = 'JSD1702' then score else 0 end) as 'jsd1702',
sum(case when class = 'JSD1703' then score else 0 end) as 'jsd1703',
sum(case when class = 'JSD1704' then score else 0 end) as 'jsd1704'
from class_score_sum group by course;
追问大神呐!让我膜拜你!