阅读背景:

一道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 countryselect
country, 
sum(case when type



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: