Re: update on join ? - Mailing list pgsql-sql

From chester c young
Subject Re: update on join ?
Date
Msg-id 169536.38344.qm@web54304.mail.re2.yahoo.com
Whole thread Raw
In response to update on join ?  (Andreas <maps.on@gmx.net>)
List pgsql-sql
> I tried
> 
> UPDATE  things JOIN inventory ON things.thing_id = inventory.thing_fk
> SET number = 0
> WHERE color = 'red'
> 

use the cool "from" clause in the update

update things tset number = 0
from inventory i
where t.thing_id = i.thing_fk
and i.color = 'red';



     ____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 


pgsql-sql by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: update on join ?
Next
From: Richard Broersma Jr
Date:
Subject: Bad Schema Design or Useful Trick?