mysql列转行

要得到

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

 

posted @ 2016-01-07 17:29  慕尘  阅读(505)  评论(0编辑  收藏  举报