in reply to Running total with SQL
A few notes:
I agree with Ovid that un-normalizing is a bad thing except where there is a good reason (Data Warehouse was the exmple) and the reason is well and widely understood.
That said you could set up a view which summarized another table (with the totals for example grouped by account) then you could select from the view by account id and the fields of the view are the relevant summary bits. This does not un-normalize your DB because views are expected to have no actual data of their own.
Also you can embed a Perl interpreter into PostgreSQL and do cool stuff that way via triggers etc.
|
|---|