select
Student,
sum(case Course when ‘数学‘ then Score else null end) 数学,
sum(case Course when ‘物理‘ then Score else null end) 物理,
sum(case Course when ‘英语‘ then Score else null end) 英语,
sum(case Course when ‘语文‘ then Score else null end) 语文
from
TEST
group by Student
链接:https://www.cnblogs.com/Mr_JinRui/archive/2011/05/27/2060109.html