我想在同一張表中使用另一條記錄更新表中的一對列。以下是我想出的SQL,但我想知道如何避免多個子查詢返回相同的記錄。我正在致力於Oracle 11gR2。避免多個子查詢
UPDATE
IFTBL E
SET
E.ATT_CREATED = (SELECT A.CREATED FROM ATT A WHERE A.ROW_ID = E.T_ACTIVITYA__RID),
E.ATT_CREATED_BY = (SELECT B.CREATED_BY FROM ATT B WHERE B.ROW_ID = E.T_ACTIVITYA__RID)
WHERE
E.IF_ROW_BATCH_NUM = BATCH_NO_IN AND E.IF_ROW_STAT = 'EXPORTED' AND E.ATT_FILE_SRC_TYPE = 'FILE';