From: Richard Broersma Jr <rabroersma@yahoo.com>
To: pgsql-sql@postgresql.org, Andreas <maps.on@gmx.net>
Subject: Re: update on join ?
Date: Wed, 21 Nov 2007 19:38:01 -0800 (PST)
Message-ID: <133720.79781.qm@web31807.mail.mud.yahoo.com> (raw)
In-Reply-To: <4744F06A.8080302@gmx.net>
--- On Wed, 11/21/07, Andreas <maps.on@gmx.net> wrote:>
> UPDATE inventory
> SET number = 0
> WHERE thing_fk IN (SELECT thing_id FROM things WHERE color
> = 'red')
This is a perfectly acceptable ANSI-SQL update statement.
Here is non-ANSI update statement that you are probably after:
UPDATE Inventory
SET number = 0
FROM Things
WHERE Inventory.thing_fk = Things.thing_id
AND Things.color = 'red';
IIRC, Joe Celko referrers to this syntax as "T-SQL".
Regards,
Richard Broersma Jr.
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: rabroersma@yahoo.com, maps.on@gmx.net
Subject: Re: update on join ?
In-Reply-To: <133720.79781.qm@web31807.mail.mud.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