横表转纵表小例子

来源:互联网 发布:linux系统打开命令窗口 编辑:程序博客网 时间:2024/06/10 19:35
select * from quot_team_member t;

select t.quot_record_id quot,
sum (case t.role_type_id when 1180000063232 then t.billing_split_pct else 0 end) as type1,
sum (case t.role_type_id when 1180000063233 then t.billing_split_pct else 0 end) as type2
from quot_team_member t group by t.quot_record_id;
0 0