首页 > 数据库技术 > 详细

SQL 行转列

时间:2018-12-17 12:41:56      阅读:127      评论:0      收藏:0      [点我收藏+]

 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

技术分享图片

SQL 行转列

原文:https://www.cnblogs.com/flyer2018/p/10130715.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!