From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | <webmaster(at)robbyslaughter(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Simple SQL-syntax |
Date: | 2001-08-20 22:06:45 |
Message-ID: | web-105447@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Laurette Cisneros | 2001-08-20 22:57:18 | quick server c question |
Previous Message | Josh Berkus | 2001-08-20 20:21:25 | Re: Simple SQL-syntax |