一道SQL面试题——表行列数据转换(表转置)
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