Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7KM6mP30693 for ; Mon, 20 Aug 2001 18:06:49 -0400 (EDT) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.1) with HTTP id 105447; Mon, 20 Aug 2001 15:06:45 -0700 From: "Josh Berkus" Subject: Re: Simple SQL-syntax To: Cc: pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.4.1 Date: Mon, 20 Aug 2001 15:06:45 -0700 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200108/253 X-Sequence-Number: 4500 Robby, > Do you know if, internally there's any difference between > > UPDATE A,B SET a.f1 = b.f1 WHERE a.i = b.i; > > -and- > > UPDATE A SET a.f1 = b.f2 FROM B WHERE a.i = b.i; > > Just wondering why the SQL standard would be broken in this > case---and if there's any reason to learn this particular > aspect of Postgres functionality.... Only if you want to use JOINS, sub-selects, and/or aliasing in your UPDATE statement. For example, I have a table that caches subtotals of its detail-level subtable: UPDATE invoice SET invoice_total = total_of_items FROM (SELECT invoice_id, sum(item_amount) FROM invoice_items) iit WHERE iit.invoice_id = invoices.id; -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco