select name,sum(case 课程 when '语文' then 成绩 else 0 end) as 语文,
sum(case 课程 when '数学' then 成绩 else 0 end) as 数学,
sum(case 课程 when '英语' then 成绩 else 0 end) as 英语
from table group by name
select name,sum(case 课程 when '语文' then 成绩 else 0 end) as 语文,
sum(case 课程 when '数学' then 成绩 else 0 end) as 数学,
sum(case 课程 when '英语' then 成绩 else 0 end) as 英语
from table group by name