MYSQL 行转列

SELECT 
`name`,
max( case `course` when '语文' then grade else 0 end) as 语文,
max( case `course` when '数学' then grade else 0 end) as 数学,
max( case `course` when '英语' then grade else 0 end) as 英语 
FROM table_a group by `name`
原文地址:https://www.cnblogs.com/xakml/p/15043419.html