UPDATE DATA IN ONE DB2 TABLE USING DATA IN ANOTHER TABLE There are instances when you wish to add a new column in a table and initialize it with data from a column in another table.
SET (A.COLUMN1) = (SELECT B.COLUMN2 FROM TABLE2 B WHERE B.COLUMN_KEY = A.COLUMN_KEY)
TABLE1 – Table in which update is to run TABLE2 – Table which contains the data to be used for update COLUMN1 – Column which needs to be updated COLUMN2 – Column whose value is to be used to populate data in COLUMN1 COLUMN_KEY – Column which is used to determine the record to be updated