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 1270F30FB55 for ; Wed, 25 Jun 2003 08:58:51 +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 85143-08 for ; Wed, 25 Jun 2003 05:58:40 -0300 (ADT) Received: from demokritos2.cytanet.com.cy (demokritos2.cytanet.com.cy [195.14.130.226]) by svr1.postgresql.org (Postfix) with ESMTP id A651830DD20 for ; Wed, 25 Jun 2003 05:58:39 -0300 (ADT) Received: from tougias (li-13-99.cytanet.com.cy [81.4.129.227]) by demokritos2.cytanet.com.cy (Postfix) with SMTP id E8D59200251 for ; Wed, 25 Jun 2003 11:58:33 +0300 (EEST) From: "Vangelis-Maria Tougia" To: Subject: UPDATE table SET col = (SELECT ...) Date: Wed, 25 Jun 2003 12:00:00 +0300 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C33B11.4EA49E80" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Spam-Status: No, hits=0.6 tagged_above=0.0 required=5.0 tests=HTML_30_40, HTML_MESSAGE, MSGID_GOOD_EXCHANGE X-Spam-Level: * X-Archive-Number: 200306/303 X-Sequence-Number: 14061 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C33B11.4EA49E80 Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: 7bit 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? 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 ------=_NextPart_000_0000_01C33B11.4EA49E80 Content-Type: text/html; charset="iso-8859-7" Content-Transfer-Encoding: quoted-printable
Hi,<= /DIV>
I found follw= ing=20 email sent to you in internet.
I am interested in= same=20 issue myself.
Did you finally fo= und out=20 any more information about how to Update a column of a table by selecting v= alue=20 from another table?
 
&nbs= p;
Hello,

If I understand the SQL references I have read, UPDATEs = are=20 allowed to
pull data from SELECT statements, something like

 = ;=20 UPDATE table SET col1 =3D (SELECT val1 FROM table WHERE id =3D=20 34),
           &= nbsp;  =20 SET col2 =3D (SELECT val2 FROM table WHERE id =3D=20 34)
         WHERE id =3D=20 35;

However, the PostgreSQL parser chokes on the 'SELECT'.=20 The
documentation says

  UPDATE table SET column =3D express= ion [,=20 ...]
      [ FROM fromlist=20 ]
      [ WHERE condition=20 ]        

  expression= =3D A=20 valid expression or value to assign to column.


I don't know exac= tly=20 how to interpret `valid expression'.
     
= --=20
Eric Marsden
emarsden @ mail.dotcom.fr
It's elephants all the way= =20 down
 
------=_NextPart_000_0000_01C33B11.4EA49E80--