update set x=(subquery on same table)

From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: update set x=(subquery on same table)
Date: 2004-02-13 08:18:14
Message-ID: 20040213081814.67615.qmail@web40612.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2004-02-13 08:27:56 Re: update set x=(subquery on same table)
Previous Message Bruce Momjian 2004-02-13 02:30:54 Re: Temporary views