Received: from msgin1.anpe.fr (nsmail@smtp1.anpe.fr [195.101.137.20]) by hub.org (8.9.3/8.9.3) with ESMTP id GAA46901 for ; Tue, 30 Nov 1999 06:23:39 -0500 (EST) (envelope-from patrick.jacquot@anpe.fr) Received: from antivirus.anpe.fr ([10.0.4.95]) by msgin1.anpe.fr (Netscape Messaging Server 3.6) with SMTP id AAA1185 for ; Tue, 30 Nov 1999 12:25:17 +0100 Sender: pjacquot Message-ID: <3843BDFD.4EF1BACE@anpe.fr> Date: Tue, 30 Nov 1999 13:07:26 +0100 From: Patrick JACQUOT Organization: DSI Noisiel X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.2.9-19mdk i586) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: found a way to update a table with data from another one Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi everybody I've read a quite old posting about the impossibility of updating a view. e.g. Let t1 (Id, balance) and t2 (id, amount) be two tables DEFINE VIEW U AS SELECT balance, amount FROM t1, t2 WHERE t1.id=t2.id; UPDATE U SET balance=balance+amount without writing a rule I found a simpler way to do the job I wanted done UPDATE t1 SET balance = balance+t2.amount WHERE EXISTS (SELECT * FROM t2 WHERE t2.id = t1.id) DOES WORK PROPERLY.