SELECT WIPtotal.期初结存,RMtotal.领料小计
from
([select TabWIPFS.pn,sum(TabWIPFS.[q-ok]) as 期初结存
from TabWIPFS
group by TabWIPFS.pn].as WIPTotal
left join
[select TabbaseFS.pn,sum(TabbaseFS.[q-ok]) as 领料小计
from TabbaseFS
where((TabbaseFS.pro)="领料")
group by TabbaseFS.pn].as RMTotal on WIPTotal.pn=RMTotal.pn)
SELECT WIPtotal.期初结存,RMtotal.领料小计
from
(select TabWIPFS.pn,sum(TabWIPFS.[q-ok]) as 期初结存
from TabWIPFS
group by TabWIPFS.pn) WIPTotal
left join
(select TabbaseFS.pn,sum(TabbaseFS.[q-ok]) as 领料小计
from TabbaseFS
where TabbaseFS.pro='领料'
group by TabbaseFS.pn) RMTotal
on WIPTotal.pn=RMTotal.pn