How to update multiple tables with one SQL statement in DB2
Pseudo-code as follows:
update TABLEA a, TABLEB b
set a.addr = 'aaa',
b.name = 'bbb'
from TABLEA a, TABLEB b
where 开发者_运维问答a.id = b.id and a.id = 1
You can only UPDATE one table. So, you can change your SQL to the following:
UPDATE tableA a
SET a.addr = 'aaa'
WHERE exists
(SELECT b.id
FROM tableB b
WHERE b.id = a.id)
精彩评论