update multiple tables using joins

by Nov 2, 2020

I am trying to update table1 based on common data between table1 and table2. But I am receiving the error:

update table1
set A.ORG_NAME = @ORG_NAME, B.REF_NAME = @REF_NAME
from table1 A, table2 B
where B.ORG_ID = A.ORG_ID
and A.ORG_ID = @ORG_ID

An unexpected token “FROM” was found following “
SET

how do I do multiple table joins in aquadata

Response

Thomas Conrad over 2 years ago
Hello,

What database and version are you using?

Thanks,

Tom

pkhalwadekar over 2 years ago
I am using

Aqua Data Studio 18.5.0-2/DB2

Thomas Conrad over 2 years ago in reply to pkhalwadekar
I guess I’m not completely clear on what you want to do? I think the syntax is incorrect for your DB2 update statement. You can find examples here.

I updated one table column from another table column using this command.

UPDATE T3 A
SET A.C2=B.C2
FROM T2 B
WHERE A.C1=B.C1

Hope that helps,

Tom