| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Joel Burton" <jburton(at)scw(dot)org> |
| Cc: | "Chuck Kimber" <chuckk(at)ext(dot)usu(dot)edu>, Pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: running totals |
| Date: | 2000-12-07 01:27:46 |
| Message-ID: | 16998.976152466@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
"Joel Burton" <jburton(at)scw(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Paul Joseph McGee | 2000-12-07 11:09:47 | gmake install error |
| Previous Message | Joel Burton | 2000-12-06 22:44:30 | RE: running totals |