Home  >  Article  >  Database  >  sql 多表返回汇总结果

sql 多表返回汇总结果

WBOY
WBOYOriginal
2016-06-07 14:57:081329browse

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)
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn