RE: running totals
От
Joel Burton
Тема
RE: running totals
Дата
Msg-id
3A2E7AFE.1129.702A05B@localhost
Список
Дерево обсуждения
running totals Mike Castle <dalgoda@ix.netcom.com>
Re: running totals "Joel Burton" <jburton@scw.org>
> >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@scw.org Support Center of Washington (www.scw.org)
В списке pgsql-novice по дате отправления