Re: Update Join Query - Mailing list pgsql-general

From Mark Roberts
Subject Re: Update Join Query
Date
Msg-id 1214250526.25936.27.camel@localhost
Whole thread Raw
In response to Update Join Query  ("Daniel Futerman" <daniel.futerman@gmail.com>)
List pgsql-general
update foo
set foo_id = g.goo_id
from goo g
where foo.foo_id = g.goo_id and foo.foo_id is not null

I think. :)

-Mark

On Mon, 2008-06-23 at 21:43 +0200, Daniel Futerman wrote:
> Hi,
>
> Looking for the correct syntax for an UPDATE LEFT JOIN query in
> PostgreSQL.
>
> The equivalent MySQL query is :
>
>     UPDATE
>         Foo f LEFT JOIN Goo g on f.Foo_ID = g.Goo_ID
>     SET
>         f.Foo_ID = g.Goo_ID
>     WHERE
>         f.Foo_ID IS NOT NULL;
>
>
>  When I try to run this in Postgres, i get the following error:
>
> ERROR:  syntax error at or near "LEFT"
>
> Is it possible to have UPDATE JOIN queries in PostgreSQL?
>
> Thanks.


pgsql-general by date:

Previous
From: "Kynn Jones"
Date:
Subject: Re: limits?
Next
From: Tom Lane
Date:
Subject: Re: limits?