数据
select name, sum(case when Q>0 then Q end) as A,sum(case when Q<0 then Q end) as B from ttt group by name
结果
版权声明:本文为fkmg001原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
数据
select name, sum(case when Q>0 then Q end) as A,sum(case when Q<0 then Q end) as B from ttt group by name
结果