Received: from shaked.cc.openu.ac.il (shaked.cc.openu.ac.il [147.233.145.65]) by hub.org (8.9.1/8.9.1) with ESMTP id DAA02756 for ; Tue, 24 Nov 1998 03:47:20 -0500 (EST) (envelope-from herouth@oumail.openu.ac.il) Received: from [147.233.159.109] (herouth@mac-herouth.pc.openu.ac.il [147.233.159.109]) by shaked.cc.openu.ac.il (8.8.8/8.8.8) with ESMTP id KAA20784; Tue, 24 Nov 1998 10:46:28 +0200 (IST) X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Tue, 24 Nov 1998 10:47:23 +0200 To: s-fery@kkt.sote.hu From: Herouth Maoz Subject: Re: [SQL] select in update Cc: pgsql-sql@postgreSQL.org At 1:41 +0200 on 24/11/98, Engard Ferenc wrote: > Yet another question: (quite busy today... :) > > oeptest=> update shorttest2 set b=(select b from shorttest t1 where >t1.a=1) where a=2; > ERROR: parser: parse error at or near "select" > > It means that the subquery in update is not implemented? And if it isn't, > how can I evade it? Maybe select ... into .., but it's not a good idea in a > big table... :((( > > Any help? The long-standing syntax for this in PostgreSQL is: UPDATE shorttest2 SET b=t1.b FROM shorttest t1 WHERE t1.a=1; Please, look up the manpages for the command you want to invoke, or \h it. You may discover syntax options that cover what you need. I have PostgreSQL 6.2.1, and running "\h update" in psql yields: testing=> \h update Command: update Description: update tuples Syntax: update set =,...= [from ] [where ]; Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma