I am just starting with Postgres and I find myself with the following Query made in Postgres, which seeks to bring me data from 4 different tables.
SELECT
table1.id,
table2.icon,
table3.title,
table4.description
FROM
table1
JOIN table5 ON id_t5 = id_t3
JOIN table3 ON id_t1 = id_t3
AND id_t3 = 816
LEFT JOIN table2 ON table5.id_t2_fk = table2.id_t2
LEFT JOIN table4 ON table4.id_t3_fk = table1.id_t1;
My problem is that I have to make an UPDATEof these 4 tables after generating the Query.
I can not think of how to solve the problem, since the UPDATE syntax of Postgres is different from that of MySQL or SQLserver.
I tried to do this:
UPDATE
table1
INNER JOIN table5 ON id_t5 = id_t3
INNER JOIN table3 ON id_t1 = id_t3
LEFT JOIN table2 ON table5.id_t2_fk = table2.id_t2
LEFT JOIN table4 ON table4.id_t3_fk = table1.id_t1
SET
table2.icon = "new icon",
table3.title = "new title",
table4.description = "new description"
WHERE
table1.id_t1= 816;