Re: UPDATE .. JOIN?

From: Sergei Shelukhin <realgeek(at)gmail(dot)com>
To: "Rodrigo E(dot) De León Plicet" <rdeleonp(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: UPDATE .. JOIN?
Date: 2008-01-13 04:26:26
Message-ID: 478992F2.6080302@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rodrigo E. De León Plicet wrote:
> On Jan 12, 2008 5:22 PM, Sergei Shelukhin <realgeek(at)gmail(dot)com> wrote:
>
>> Hi.
>>
>> I was wondering if I could do something similar to this in Postgres and
>> if yes how?
>>
>> UPDATE table1 SET blah = 1 FROM table1
>> INNER JOIN table2 ON table1.id = table2.t1id
>>
>
> UPDATE table1 t1
> SET blah = 1
> FROM table2 t2
> WHERE t1.id = t2.t1id
>
>
Hmmm. What if there's more than one table? Is "from x,y" a viable option?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gurjeet Singh 2008-01-13 04:44:42 ERROR during WAL replay
Previous Message Rodrigo E. De León Plicet 2008-01-13 04:22:16 Re: UPDATE .. JOIN?