select name as 姓名,max(case when subject='语文' then result else '' end) as `语文`, max(case when subject='数学' then result else '' end) as `数学`, max(case when subject='英语' then result else '' end) as `英语` from stu GROUP BY name
select distinct 学生,
(select distinct 成绩 from student where 科目='语文' and 学生 like a.学生) as 语文,
(select distinct 成绩 from student where 科目='数学' and 学生 like a.学生) as 数学,
(select distinct 成绩 from student where 科目='英语' and 学生 like a.学生) as 英语
from student a