Re: update on join ?

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org, Andreas <maps(dot)on(at)gmx(dot)net>
Subject: Re: update on join ?
Date: 2007-11-22 03:38:01
Message-ID: 133720.79781.qm@web31807.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--- On Wed, 11/21/07, Andreas <maps(dot)on(at)gmx(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message chester c young 2007-11-22 03:41:54 Re: update on join ?
Previous Message Frank Bax 2007-11-22 03:34:24 Re: update on join ?