X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 2CA47310076 for ; Thu, 26 Jun 2003 21:12:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 24244-07 for ; Thu, 26 Jun 2003 18:12:13 -0300 (ADT) Received: from post.webmailer.de (natsmtp01.webmailer.de [192.67.198.81]) by svr1.postgresql.org (Postfix) with ESMTP id 1BC2430FF80 for ; Thu, 26 Jun 2003 18:12:13 -0300 (ADT) Received: from iwate.ianb.homelinux.net (pD9E0EA15.dip.t-dialin.net [217.224.234.21]) by post.webmailer.de (8.12.8/8.8.7) with ESMTP id h5QLCAea022154; Thu, 26 Jun 2003 23:12:10 +0200 (MEST) From: Ian Barwick To: "Vangelis-Maria Tougia" , Subject: Re: UPDATE table SET col = (SELECT ...) Date: Thu, 26 Jun 2003 23:11:10 +0200 User-Agent: KMail/1.5.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200306262311.10435.barwick@gmx.net> X-Archive-Number: 200306/305 X-Sequence-Number: 14063 On Wednesday 25 June 2003 11:00, Vangelis-Maria Tougia wrote: > Hi, > I found follwing email sent to you in internet. > I am interested in same issue myself. > Did you finally found out any more information about how to Update a column > of a table by selecting value from another table? Not sure if this has been answered previously, but here goes: > Hello, > > If I understand the SQL references I have read, UPDATEs are allowed to > pull data from SELECT statements, something like > > UPDATE table SET col1 = (SELECT val1 FROM table WHERE id = 34), > SET col2 = (SELECT val2 FROM table WHERE id = 34) ^^^ > WHERE id = 35; The second "SET" is not necessary or allowed and is causing the update to fail. Ian Barwick barwick@gmx.net