這是我的試用查詢。我正在嘗試根據person_id更新TABLE1
表以及來自ADDR
的相應數據。這下面說失蹤的SET關鍵字。使用另一個表中的數據更新一個表 - Oracle
UPDATE TABLE1 CFI
INNER JOIN
(
SELECT ADDRESS_LINE1, ADDRESS_LINE2, CITY, STATE_PROVINCE, ZIP FROM ADDR WHERE PERSON_ID = CFI.PERSON_ID AND STATUS = 'Active'
) AS ADDR_DATA
SET CFI.PAYEE_ADDRESS1 = ADDR_DATA.ADDRESS_LINE1,
CFI.PAYEE_ADDRESS2 = ADDR_DATA.ADDRESS_LINE2,
CFI.PAYEE_CITY= ADDR_DATA.CITY,
CFI.PAYEE_STATE_PROVINCE = ADDR_DATA.STATE_PROVINCE,
CFI.PAYEE_POSTALCODE = ADDR_DATA.ZIP,
CFI.PAYEE_COUNTRY_CODE = 'USA'
WHERE CFI.CUSTOMER_INSTITUTION_ID = 966362 AND CFI.PERSON_ID = ADDR_DATA.PERSON_ID;
請大家幫忙。提前致謝。
感謝您的回覆。但它說缺少ON關鍵字。 – Vaandu 2012-03-22 15:52:49
嘗試從ADDR_DATA子查詢中選擇'PERSON_ID',它工作。非常感謝。 – Vaandu 2012-03-22 16:06:12