update set x=(subquery on same table) - Mailing list pgsql-general

From CSN
Subject update set x=(subquery on same table)
Date
Msg-id 20040213081814.67615.qmail@web40612.mail.yahoo.com
Whole thread Raw
Responses Re: update set x=(subquery on same table)  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
I'm trying to do:

update nodes n1 set n1.parent_id=(select n2.id from
nodes n2 where n2.key=n1.parent_id);

To set parent_id to the id of the parent (rather than
the key). Would UPDATE FROM fromlist work? I couldn't
find any examples of it's use.

TIA,
CSN



__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Temporary views
Next
From: Martijn van Oosterhout
Date:
Subject: Re: update set x=(subquery on same table)