X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BBBE95289D for ; Wed, 15 Jun 2005 08:39:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69280-08 for ; Wed, 15 Jun 2005 11:38:58 +0000 (GMT) Received: from mail.sto.netlight.se (1-1-10-39a.sh.sth.bostream.se [82.182.50.216]) by svr1.postgresql.org (Postfix) with ESMTP id 2A81D52836 for ; Wed, 15 Jun 2005 08:38:56 -0300 (ADT) Received: from prraxp ([192.168.12.76]) by mail.sto.netlight.se (8.11.2/8.11.2) with ESMTP id j5FCRu316389 for ; Wed, 15 Jun 2005 14:27:57 +0200 From: "Praveen Raja" To: Subject: update syntax Date: Wed, 15 Jun 2005 13:39:11 +0200 Message-ID: <002401c5719e$dc9682b0$4c0ca8c0@sek.se> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0025_01C571AF.A01F52B0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/166 X-Sequence-Number: 21767 This is a multi-part message in MIME format. ------=_NextPart_000_0025_01C571AF.A01F52B0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hi, While using Ms SQL server I used to write update statements like this, UPDATE a SET a.col1 = b.col1 FROM table1 a INNER JOIN table1 b ON a.col2 = b.col2 WHERE a.col3 = 'something' AND b.col3 = 'somethingelse' But I can't seem to do this in postgres, it gives me an error saying 'syntax error at or near "."'. How can I do something similar to this i.e. join on the same table? Thanks, /P ------=_NextPart_000_0025_01C571AF.A01F52B0 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

Hi,

 

While using Ms SQL server I used to write = update statements like this,

 

UPDATE a SET a.col1 =3D = b.col1

FROM table1 a

INNER JOIN table1 b

ON a.col2 =3D b.col2

WHERE a.col3 =3D = ‘something’

AND b.col3 =3D = ‘somethingelse’

 

But I can’t seem to do this in postgres, = it gives me an error saying ‘syntax error at or near = “.”’. How can I do something similar to this i.e. join on the same = table?

 

Thanks,

/P

------=_NextPart_000_0025_01C571AF.A01F52B0--