INSERT DW_OLAP.DBO.INVTURNOVER(F_ERPQTY,F_MaterialId)
SELECT sum(TimeInv.F_Qty),TimeInv.F_Material
from DW_BASE.dbo.PSCM_PR_LWMS_TimeInventory TimeInv
inner join DW_BASE.dbo.PSCM_PR_SSO_Organization as Org
on TimeInv.F_Owner = Org.F_Key
inner join DW_BASE.dbo.PSCM_PR_SSO_OrganizationType as OrgType
on Org.F_Type = OrgType.F_Key
where OrgType.F_Code = 'BU'
and TimeInv.F_TimePoint <= getdate()-1
group by TimeInv.F_Material
update a
set a.num = a.num + b.num
from table1 a inner join table2 b on a.id = b.id --(关联条件)
where ... --如果有条件的话
--你的可以这么写
update a
set a.num = a.num + b.num
from table1 a
inner join (你的查询写在这里) b on a.id = b.id --(关联条件)
where ... --如果有条件的话