Search Postgresql Archives

Re: 3 tables join update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx

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 //

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux