数据库刷两个表数据的脚本

UPDATE aps_tailor_instruction_detail_rec o, (SELECT a.tailorAssemblyLineId,a.tailorAssemblyLineCode,a.deptId,c.name tailorAssemblyLineName,b.id productionSubPlanDetailId,a.id productionSubPlanId,a.planNumber

FROM aps_production_sub_plan a,aps_production_sub_plan_detail b,md_tailor_assembly_line c WHERE a.id=b.productionSubPlanId  AND a.tailorAssemblyLineId=c.id 

AND b.id=79751 AND a.factoryId=46 AND a.disabled=0) n

SET o.tailorAssemblyLineId = n.tailorAssemblyLineId, o.tailorAssemblyLineCode = n.tailorAssemblyLineCode,o.deptId = n.deptId,o.tailorAssemblyLineName = n.tailorAssemblyLineName,

o.productionSubPlanId=n.productionSubPlanId,o.subPlanNumber=n.planNumber,o.productionSubPlanDetailId=n.productionSubPlanDetailId

WHERE instructionNumber IN ('CZ22010136','CZ22010137','CZ22010140') AND factoryId=46 AND disabled=0 AND size='170/92A'

AND o.productionSubPlanId=5572

你可能感兴趣的:(数据库刷两个表数据的脚本)