select name,code,max(case when subject="语文" then score else 0 end)as 语文,max(case when subject="数学" then score else 0 end)as 数学,max(case when subject="英语" then score else 0 end)as 英语 from (select s.name,s.code,e.subject,e.score from stu s join exam e on s.code=e.code order by e.subject)as a group by name;
列出每位学生的各科成绩,要求输出格式:姓名、学号、语文成绩、数学成绩、英语成绩,SQL怎么编写
最新推荐文章于 2022-11-08 20:15:37 发布