要得到
SELECT name, SUM(CASE course WHEN '语文' THEN score END ) AS '语文', SUM(CASE course WHEN '数学' THEN score END ) AS '数学', SUM(CASE course WHEN '英语' THEN score END ) AS '英语' FROM grade GROUP BY name
要得到
SELECT name, SUM(CASE course WHEN '语文' THEN score END ) AS '语文', SUM(CASE course WHEN '数学' THEN score END ) AS '数学', SUM(CASE course WHEN '英语' THEN score END ) AS '英语' FROM grade GROUP BY name