Re: UPDATE .. JOIN? - Mailing list pgsql-general

From Rodrigo E. De León Plicet
Subject Re: UPDATE .. JOIN?
Date
Msg-id a55915760801122105n5c6faf40w5a15adad13d350b7@mail.gmail.com
Whole thread Raw
In response to Re: UPDATE .. JOIN?  (Sergei Shelukhin <realgeek@gmail.com>)
Responses Re: UPDATE .. JOIN?
List pgsql-general
On Jan 12, 2008 11:26 PM, Sergei Shelukhin <realgeek@gmail.com> wrote:
> Hmmm. What if there's more than one table? Is "from x,y" a viable option?

UPDATE table1 t1
SET blah = 1
FROM (
  SELECT t2.t1id
  FROM table2 t2
  JOIN table3 t3
  ON t2.id = t3.t2id
) foobar
WHERE t1.id = foobar.t1id

It's all in the docs:
http://www.postgresql.org/docs/8.2/static/sql-update.html

Good luck.

pgsql-general by date:

Previous
From: "Gurjeet Singh"
Date:
Subject: ERROR during WAL replay
Next
From: "Rodrigo E. De León Plicet"
Date:
Subject: Re: UPDATE .. JOIN?