-- ORACLE 11G 表联合更新多列
update apps.SGD_ACTUAL_WIP_COST cst
set (cst.ITEM_ID,cst.WIP_ENTITY_ID,cst.STATUS_TYPE,
cst.START_QUANTITY,cst.NET_QUANTITY,
cst.QUANTITY_COMPLETED,cst.DATE_RELEASED,cst.DATE_CLOSED ) =
( select wip.primary_item_id as ITEM_ID,wip.WIP_ENTITY_ID,wip.STATUS_TYPE,
wip.START_QUANTITY,wip.NET_QUANTITY,
wip.QUANTITY_COMPLETED,wip.DATE_RELEASED,wip.DATE_CLOSED
from apps.wip_discrete_jobs_V wip
where wip.wip_entity_name =cst.wip_entity_name )
where PERIOD= '1704'
and CST.WIP_ENTITY_NAME IS NOT NULL
and cst.wip_entity_name ='DD32DI022' -- 'DD421I061'
MSSQL:
UPDATE 别名1
SET 别名1.COL1 = 别名2.COL20,
别名1.COL2 = 别名2.COL21,
别名1.COL3 = 别名2.COL22
FROM 表名 别名1, 表名2 别名2
WHERE 别名1.ID = 别名2.ID and 条件