Re: running totals - Mailing list pgsql-novice

From Tom Lane
Subject Re: running totals
Date
Msg-id 16998.976152466@sss.pgh.pa.us
Whole thread Raw
In response to RE: running totals  ("Joel Burton" <jburton@scw.org>)
List pgsql-novice
"Joel Burton" <jburton@scw.org> writes:
>>>> CREATE VIEW tape_view AS
>>>> SELECT id, tape_name, sum(runtime)
>>>> FROM tape t,
>>>> show s
>>>> WHERE t.id = s.tape_id
>>>> GROUP BY id, tape_name;
>>>>
>>>> Which means you can just
>>
>>>> SELECT * FROM tape_view;

One caveat here: grouped views are pretty flaky in 7.0.* and before,
because the system doesn't support multiple levels of grouping.
For example, you might think you could do
    SELECT avg(runtime) FROM tape_view;
but it won't work.  This should work in 7.1, however.

            regards, tom lane

pgsql-novice by date:

Previous
From: Andrew McMillan
Date:
Subject: Re: access.mdb import
Next
From: Helge Bahmann
Date:
Subject: Index creation