select a.*,bb.领料数量,dd.完工数量
from a
left join (select 生产批号,sum(领料数量) as 领料数量 from b group by 生产批号) bb
on a.生产批号=b.生产批号
left join (select cc.生产批号,sum(d.完工数量) as 完工数量
from (select distinct 生产批号,rcid from c) cc,d
where c.rcid=d.rcid
group by c.生产批号
) dd on a.生产批号=dd.生产批号
;