2020-09-07
阅读量:
1143
sql面试题:一维表如何转换成二维表
问题:
解答:
select cus_id,sum(case acc_type when 'checking' then acc_no else null end) as 'checking account',
sum(case acc_type when 'saving' then acc_no else null end) as 'saving account'
from t_a
group by cus_id;
用到case..when ..then..else语句






评论(0)


暂无数据
推荐帖子
1条评论
0条评论
0条评论