select a.采购单,a.采购数量,b.入库数量,c.退货数量,d.退货后补货数量 from
aaa a
join(select id,sum(入库数量) as 入库数量 from bbb) b on a.id=b.id
join(select id,sum(退货数量) as 退货数量 from ccc) c on b.id=c.id
join(select id,sum(补货数量) as 退货后补货数量 from ddd) d on c.id=d.id