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      [EMAIL PROTECTED]
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to