Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6CCEC475DD0 for ; Wed, 2 Oct 2002 13:43:29 -0400 (EDT) Received: from email02.aon.at (WARSL402PIP7.highway.telekom.at [195.3.96.94]) by postgresql.org (Postfix) with SMTP id 58BBB475D1C for ; Wed, 2 Oct 2002 13:43:28 -0400 (EDT) Received: (qmail 360772 invoked from network); 2 Oct 2002 17:43:27 -0000 Received: from m164p012.dipool.highway.telekom.at (HELO cantor) ([62.46.10.108]) (envelope-sender ) by qmail2rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 2 Oct 2002 17:43:27 -0000 From: Manfred Koizar To: Thrasher Cc: pgsql-sql@postgresql.org Subject: Re: Updating from select Date: Wed, 02 Oct 2002 19:45:44 +0200 Message-ID: References: <3D9B28B7.4000903@fibers.upc.es> In-Reply-To: <3D9B28B7.4000903@fibers.upc.es> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/22 X-Sequence-Number: 9740 On Wed, 02 Oct 2002 19:11:19 +0200, Thrasher wrote: >UPDATE trans_log t SET t.cost = > (SELECT SUM(p.cost) FROM products_log p WHERE p.trans = t.id) Thrasher, try it without the table alias t: UPDATE trans_log SET cost = (SELECT SUM(p.cost) FROM products_log p WHERE p.trans = trans_log.id) Servus Manfred