From: chester c young <chestercyoung@yahoo.com>
To: Andreas <maps.on@gmx.net>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: update on join ?
Date: Wed, 21 Nov 2007 19:41:54 -0800 (PST)
Message-ID: <169536.38344.qm@web54304.mail.re2.yahoo.com> (raw)
In-Reply-To: <4744F06A.8080302@gmx.net>
> 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 t
set 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: chestercyoung@yahoo.com, maps.on@gmx.net
Subject: Re: update on join ?
In-Reply-To: <169536.38344.qm@web54304.mail.re2.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox