竖表变横表麻烦大师改下
SELECT * FROM(SELECT cjzk as 学籍辅号, SUM(CASE WHEN subject = '语文' THEN score END) AS 语文,SUM(CASE WHEN subject = '数学' THEN score END) AS 数学,SUM(CASE WHEN subject = '英语' THEN score END) AS 英语 FROM user GROUP BY 学籍辅号) temp
DATA.rar
(1.35 KB)