SELECT `name`, max( case `course` when ‘语文‘ then grade else 0 end) as 语文, max( case `course` when ‘数学‘ then grade else 0 end) as 数学, max( case `course` when ‘英语‘ then grade else 0 end) as 英语 FROM table_a group by `name`
2021-09-29 02:56:14
SELECT `name`, max( case `course` when ‘语文‘ then grade else 0 end) as 语文, max( case `course` when ‘数学‘ then grade else 0 end) as 数学, max( case `course` when ‘英语‘ then grade else 0 end) as 英语 FROM table_a group by `name`