I have 3 tables and I want to update table1 (column status) with information (column status) from table2. the link between table1 and table2 is in the table table_con
http://www.sqlfiddle.com/#!15/6ce460/4
I thought about a join and using the result of the join to update table1
select t1.status as t1status,t2.status as t2status,t1.p_id as t1pid, t2.x_id as t2xid
from table1 t1
JOIN table_con tc
ON t1.p_id = tc.p_id
JOIN table2 t2
ON t2.x_id = tc.x_id;
The join works so far, but I don't know how to continue,
and the query should work in psql. thanks