多
多多帮助
Unregistered / Unconfirmed
GUEST, unregistred user!
select a.商品编号, ISNULL(b.进货数量, 0) 进货数量, ISNULL(b.进货金额, 0) AS 进货金额, ISNULL(c.销售数量, 0) AS 销售数量, ISNULL(c.销售金额, 0) AS 销售金额 from 商品表 LEFT OUTER JOIN (select 商品编号, sum(进货数量) AS 进货数量, sum(进货金额) AS 进货金额 from 进货表 group by 商品编号) b ON a.商品编号=b.商品编号 LEFT OUTER JOIN (select 商品编号, sum(销售数量) as 销售数量,sum(销售金额) as 销售金额 from 销售表 group by 商品编号) C on a.商品编号=c.商品编号怎么改成计算成本金额?多谢