sql 多表返回汇总结果

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

with tb(id,product,barcode,qty) as
(
select 1,'AA',240,3
union all select 2,'BB',245,2
union all select 3,'AA',255,2
union all select 4,'BB',240,1
)

select * from tb compute sum(qty),sum(barcode)