Received: from mta7.pltn13.pbi.net (mta7.pltn13.pbi.net [64.164.98.8]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g1JJZZE79132 for ; Tue, 19 Feb 2002 14:35:35 -0500 (EST) (envelope-from benoitm@pacbell.net) Received: from Kestrel ([209.232.53.88]) by mta7.pltn13.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GRS00MGUP3BD8@mta7.pltn13.pbi.net> for pgsql-sql@postgresql.org; Tue, 19 Feb 2002 11:35:35 -0800 (PST) Date: Tue, 19 Feb 2002 11:35:32 -0800 From: Benoit Menendez Subject: Re: Problem with self-join updates... To: pgsql-sql@postgresql.org Message-id: <001901c1b97c$98828b60$0d01a8c0@Kestrel> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Mailer: Microsoft Outlook Express 6.00.2600.0000 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT X-Priority: 3 X-MSMail-priority: Normal References: <002101c1b650$18f087a0$0201a8c0@osprey> <002b01c1b973$bf48c740$0201a8c0@osprey> <6776.1014145606@sss.pgh.pa.us> X-Archive-Number: 200202/241 X-Sequence-Number: 6665 Thanks, this works... I did not know about the implicit table reference... Now, I'm waiting for outer join updates and deletes so I don't have to use in and sub-selects... PostgreSQL rules... Benoit ----- Original Message ----- From: "Tom Lane" To: "Benoit Menendez" Cc: Sent: Tuesday, February 19, 2002 11:06 AM Subject: Re: [SQL] Problem with self-join updates... > Benoit Menendez writes: > > I have the following self-join update: > > > update TABLE set PARENT_ID=parent.PARENT_ID > > from TABLE, TABLE parent > > where TABLE.PARENT_ID=parent.ID > > and parent.ID in (1,2,3,4) > > > Table name "table" specified more than once > > Wasn't this answered already? You should not have the "from TABLE" > in there. Essentially, there's already an implicit FROM entry for > the target table, you don't need another. "from TABLE parent" > is sufficient here. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html