Consider the following select query:
SELECT s.id, s.event, s.column, e.oldcolumn
FROM section as s
INNER JOIN event as e
ON s.event = e.id
WHERE s.id = 1
Now I wish to update the section table so that the values are equal to the oldcolumn
from the event table.
I tried:
UPDATE public."section"
SET public."section".column = public."event".oldcolumn
FROM public."section"
INNER JOIN public."event"
on public."section".event = public."event".id
WHERE s.id = 1
However this, on postgresql, returned the following error:
ERROR: table name "section" specified more than once
SQL state: 42712
How would I do such a thing, using joins inside an update query?