当前位置:Gxlcms > 数据库问题 > SQL 实现行列互换

SQL 实现行列互换

时间:2021-07-01 10:21:17 帮助过:73人阅读

select 年, 2 sum(case when 季度=1 then 销售量 else 0 end) as 一季度, 3 sum(case when 季度=2 then 销售量 else 0 end) as 二季度, 4 sum(case when 季度=3 then 销售量 else 0 end) as 三季度, 5 sum(case when 季度=4 then 销售量 else 0 end) as 四季度 6 from sales group by 年;

 

SQL 实现行列互换

标签:

人气教程排行