select a.`name`, sum((CASE kemu WHEN '语文' THEN score ELSE 0 END)) '语文', sum((CASE kemu WHEN '数学' THEN score ELSE 0 END)) '数学', sum((CASE kemu WHEN '英语' THEN score ELSE 0 END))'英语' from t_score a GROUP BY a.`name`;