SELECT id_num, MAX(score_chinese) AS '國文成績', MAX(score_english) AS '英文成績', MAX(score_math) AS '數學成績' FROM( SELECT id_num, CASE WHEN subject='國文' THEN score END AS score_chinese, CASE WHEN subject='英文' THEN score END AS score_english, CASE WHEN subject='數學' THEN scree END AS score_math FROM score_table ) AS score_table_tmp GROUP BY id_num
沒有留言:
張貼留言