I am trying to join three tables within an update statement, but I have been unsuccessful so far. I know this query works for joining two tables:
update table 1
set x = X * Y
from table 1 as t1 join table 2 as t2 on t1.column1 = t2.column1
However, in my case, I need to join three tables so:
update table 1
set x = X * Y
from table 1 as t1 join table 2 as t2 join table3 as t3
on t1.column1 = t2.column1 and t2.cloumn2 = t3.column1
Will not work. I also tried the following query:
update table 1
set x = X * Y
from table 1, table 2, table 3
where column1 = column2 and column2= column3
Does anyone know of a method to accomplish this?