Time interval sums
Time interval sums
От:
"A. R. Van Hook" <hook@lake-lotawana.mo.us>
Дата:
How does one sum interval sums?
the following does not work:select sum(stop-start::interval) as total from startstop where sid = 545 and 2006 = date_part('year', day) and 9 = date_part('month', day)
however select stop-start::interval) as total from startstop where sid = 545 and 2006 = date_part('year', day) and 9 = date_part('month', day)
works great but I need an overall sum
Table schema: Table "public.startstop"Column | Type | Modifiers
--------+------------------------+-----------sid | integer | not nullstart | time without time zone |stop | time without time zone |day | date | not null
thanks
--
Arthur R. Van Hook Mayor
The City of Lake Lotawana
hook@lake-lotawana.mo.us
(816) 578-4704 - Home
(816) 578-4215 - City
(816) 564-0769 - Cell
Re: Time interval sums
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"A. R. Van Hook" writes: > How does one sum interval sums? > the following does not work: > select sum(stop-start::interval) as total from startstop Define "does not work"? What did you get, what were you hoping for? Personally I'd drop the unnecessary cast, but AFAICS there are appropriate operators at least as far back as 7.3. regards, tom lane