Time interval sums

From: "A(dot) R(dot) Van Hook" <hook(at)lake-lotawana(dot)mo(dot)us>
To: General Postgresql List <pgsql-sql(at)postgresql(dot)org>
Subject: Time interval sums
Date: 2006-10-02 20:58:53
Message-ID: 45217D8D.7060106@lake-lotawana.mo.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 null
start | 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(at)lake-lotawana(dot)mo(dot)us

(816) 578-4704 - Home
(816) 578-4215 - City
(816) 564-0769 - Cell

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-10-02 21:29:52 Re: Time interval sums
Previous Message Thomas Kellerer 2006-10-02 16:51:04 Re: SEQUENCES