Received: from laas.laas.fr (root@laas.laas.fr [140.93.0.15]) by hub.org (8.9.1/8.9.1) with ESMTP id MAA03358 for ; Wed, 30 Dec 1998 12:01:33 -0500 (EST) (envelope-from emarsden@laas.fr) Received: from dukas.laas.fr (dukas [140.93.21.58]) by laas.laas.fr (8.9.1a/8.9.1) with ESMTP id SAA27795 for ; Wed, 30 Dec 1998 18:01:29 +0100 (MET) Received: (from emarsden@localhost) by dukas.laas.fr (8.9.1a/8.9.1) id SAA07087; Wed, 30 Dec 1998 18:01:28 +0100 (MET) Sender: emarsden@dukas.laas.fr To: pgsql-sql@postgresql.org Subject: UPDATE table SET col = (SELECT ...) Organization: LAAS-CNRS http://www.laas.fr/ X-Eric-Conspiracy: there is no conspiracy X-Attribution: ecm X-URL: http://www.chez.com/emarsden/ From: Eric Marsden Date: 30 Dec 1998 18:01:28 +0100 Message-ID: Lines: 25 X-Mailer: Gnus v5.3/Emacs 19.34 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; However, the PostgreSQL parser chokes on the 'SELECT'. The documentation says UPDATE table SET column = expression [, ...] [ FROM fromlist ] [ WHERE condition ] expression = A valid expression or value to assign to column. I don't know exactly how to interpret `valid expression'. -- Eric Marsden emarsden @ mail.dotcom.fr It's elephants all the way down