I was able to do the merge using the following code.
Code:
MERGE INTO tbltarget AS A
USING (
SELECT B.CUSTNUM_NEW, B.CUSTNUM_OLD, B.MASTER FROM tblsource B
) AS B ON (
B.CUSTNUM_OLD = A.CUSTNUM AND B.MASTER='0'
)
WHEN MATCHED THEN
UPDATE SET
A.CUSTNUM = B.CUSTNUM;
Update or merge field from 2nd table - DB2 iSeries
I am working on an iSeries v7r1 to consolidate customer accounts after de-deuplication. I am struggling with a fairly simply update to a single field from a value in another table.
tbl_target
CUSTNUM
tbl_source
CUSTNUM_NEW
CUSTNUM_OLD
MASTER
What I need to do is
UPDATE tbl_target.CUST NUM=tbl_source. CUSTNUM_NEW WHERE tbl_target.CUST NUM = tbl_source_OLD ONLY getting the...
Leave a comment: