Received: from kss.net.au ([203.41.122.41]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0I3xT094676 for ; Wed, 17 Jan 2001 22:59:32 -0500 (EST) (envelope-from carolyn@greatpacific.com.au) Received: from greatpacific.com.au (coco [10.10.1.9]) by kss.net.au (8.8.7/8.8.7) with ESMTP id OAA06753; Thu, 18 Jan 2001 14:58:47 +1100 Message-ID: <3A6669ED.C37F420C@greatpacific.com.au> Date: Thu, 18 Jan 2001 14:58:37 +1100 From: Carolyn Lu Wong Organization: Great Pacific Financial Group X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Tubagus Nizomi CC: pgsql-sql@postgresql.org Subject: Re: update help References: <3A665AE3.CE43178B@greatpacific.com.au> <01011810173404.01195@nizomi> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200101/205 X-Sequence-Number: 870 This update field with the sum of all amounts in t2. I want to update sum of each individual IDs. Tubagus Nizomi wrote: > > update t1 > set amount = sum(b.amount) > from ts b > where a.id=b.id > > On Thursday 18 January 2001 09:54, Carolyn Wong wrote: > > I'd like to know what's the correct SQL statement to do the following: > > > > update t1 a > > set a.amount = sum(b.amount) > > from t2 b > > where a.id = b.id