首页 > 数据库技术 > 详细

一道SQL面试题——表行列数据转换(表转置)

时间:2018-08-18 10:02:52      阅读:223      评论:0      收藏:0      [点我收藏+]

技术分享图片
SQL语句如下:

select
country, 
sum(case when type='A' then money end) as A,
sum(case when type='B' then money end) as B,
sum(case when type='C' then money end) as C
from table1
group by country

本文转自:https://blog.csdn.net/Eastmount/article/details/50559008

一道SQL面试题——表行列数据转换(表转置)

原文:https://www.cnblogs.com/lanqiu5ge/p/9496000.html

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