Re: 3 tables join update - Mailing list pgsql-general

From Alban Hertroys
Subject Re: 3 tables join update
Date
Msg-id 4700B585.7040503@magproductions.nl
Whole thread Raw
In response to Re: 3 tables join update  (rihad <rihad@mail.ru>)
List pgsql-general
rihad wrote:
> Richard Broersma Jr wrote:
> UPDATE Foo foo
> SET ...
> FROM LEFT JOIN Bar bar USING(common_field)
> WHERE blah='blah' AND bar.common_field IS NULL;
>
> ERROR:  syntax error at or near "JOIN"
>
>
> I know I'm misusing UPDATE ... FROM because I don't really want Bar's
> values to go into Foo, but only using them for a conditional update
> (atomically I hope).

Oh, you mean:

UPDATE foo
SET ...
WHERE blah = 'blah'
  AND NOT EXISTS (
    SELECT 1 FROM baz WHERE foo.common_field = baz.common_field
  )

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: more problems with count(*) on large table
Next
From: Jorge Godoy
Date:
Subject: Re: COPY for .CSV files problem