| From: | "Joel Burton" <jburton(at)scw(dot)org> |
|---|---|
| To: | "Chuck Kimber" <chuckk(at)ext(dot)usu(dot)edu> |
| Cc: | Pgsql-novice(at)postgresql(dot)org |
| Subject: | RE: running totals |
| Date: | 2000-12-06 22:44:30 |
| Message-ID: | 3A2E7AFE.1129.702A05B@localhost |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
> >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;
>
> Wow! This is a great idea... I had never thought of using a view
for
> this type of calculation. I always did it the hard way. Question
> though, does the VIEW keep the sum current at all times, or does
it
> just update when a query is run on the VIEW?
The view *IS* a query, really. When you SELECT from the VIEW,
you're really running a SELECT. So, no, merely updating in the the
table doesn't affect the view, only when you select from the view.
--
Joel Burton, Director of Information Systems -*- jburton(at)scw(dot)org
Support Center of Washington (www.scw.org)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2000-12-07 01:27:46 | Re: running totals |
| Previous Message | brentr | 2000-12-06 20:31:59 | Unload of Data |