这样?查询所有款号情况
select * from (select 销售商场,a.款号,销售类型,件数,成交价,入库商场,入库件数 from(select 销售商场,款号,销售类型,sum(件数) as 件数,sum(成交价) as 成交价 from {销售表} group by 销售商场,款号,销售类型) a left join (select 款号,入库商场,sum(件数) as 入库件数 from {入库表} group by 款号,入库商场) b on a.款号=b.款号 and a.销售商场=b.入库商场) c left join (select 款号,出库商场,sum(出库件数) as 出库件数 from {出库表} group by 款号,出库商场) d on c.款号=d.款号 and c.销售商场=d.出库商场
指定款号
select * from (select 销售商场,a.款号,销售类型,件数,成交价,入库商场,入库件数 from(select 销售商场,款号,销售类型,sum(件数) as 件数,sum(成交价) as 成交价 from {销售表} group by 销售商场,款号,销售类型) a left join (select 款号,入库商场,sum(件数) as 入库件数 from {入库表} group by 款号,入库商场) b on a.款号=b.款号 and a.销售商场=b.入库商场) c left join (select 款号,出库商场,sum(出库件数) as 出库件数 from {出库表} group by 款号,出库商场) d on c.款号=d.款号 and c.销售商场=d.出库商场 where c.款号='G2162JE23'