SELECT [商品编码].[商品编码], [商品编码].[商品名称], [商品编码].[类别], [商品编码].[零售价], Sum([库存查询].[出库数量]) AS 出库数量, Sum([库存查询].[进货数量]) AS 进货数量, [进货数量]-[出库数量] AS 库存, [库存]*[零售价] AS 金额
FROM 商品编码 INNER JOIN 库存查询 ON [商品编码].[商品编码]=[库存查询].[商品编码]
GROUP BY [商品编码].[商品编码], [商品编码].[商品名称], [商品编码].[类别], [商品编码].[零售价];