test表:
执行列转行sql:
select student, sum(case Course when ‘语文‘ then Score else null end) 语文, sum(case Course when ‘数学‘ then Score else null end) 数学, sum(case Course when ‘英语‘ then Score else null end) 英语 from test group by student
得到结果:
时间: 2024-10-13 01:41:29