> On Thu, Oct 10, 2013 at 10:03 AM, Rob Richardson
> <rdrichard...@rad-con.com> wrote:
> 
> > UPDATE inner_covers
> > SET X = (SELECT sl.X FROM storage_locations sl where sl.name = 
> > inner_covers.name),
> > Y = (SELECT sl.Y FROM storage_locations sl where sl.name = 
> > inner_covers.name)
> >
> > Or is there another, more convenient form of the UPDATE query that I'm not 
> > familiar with?
> >
> > Thanks very much!
> 
> you have UPDATE FROM:
> 
> UPDATE foo SET a=bar.a, b=bar.b
> FROM bar WHERE foo.id = bar.id;
> 
> merlin

Hi,

an alternate syntax which is nearer to the INSERT one:

update foo set (a,b) = (bar.a, bar.b) 
FROM bar 
WHERE foo.id = bar.id;

I guess this is just a question of taste...

regards,

Marc Mamin

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to