欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

sql 多表返回汇总结果

程序员文章站 2022-04-13 15:20:19
...

t-sqlcompute函数 目前只在2008里用了。。其他的么有试过 无 with tb(id,product,barcode,qty) as(select 1,'AA',240,3union all select 2,'BB',245,2union all select 3,'AA',255,2union all select 4,'BB',240,1)select * from tb compute sum(qty),sum(bar

t-sql compute函数
目前只在2008里用了。。其他的么有试过
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)