您的位置:首页 > 博客中心 > 数据库 >

SQL 行转列

时间:2022-03-15 12:18

 1 select * from Score 

技术分享图片

1 select student,
2 sum(case course when ‘语文‘ then score end) as ‘语文‘,
3 sum(case course when ‘数学‘ then score end) as ‘数学‘,
4 sum(case course when ‘英语‘ then score end) as ‘英语‘
5 from Score 
6 group by student

技术分享图片

热门排行

今日推荐

热门手游