pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. R. Van Hook <hook@lake-lotawana.mo.us>
To: General Postgresql List <pgsql-sql@postgresql.org>
Subject: Time interval sums
Date: Mon, 02 Oct 2006 15:58:53 -0500
Message-ID: <45217D8D.7060106@lake-lotawana.mo.us> (raw)

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@lake-lotawana.mo.us

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




view thread (2+ messages)  latest in thread

Message-ID: <45217D8D.7060106@lake-lotawana.mo.us>
Permalink:  ../45217D8D.7060106@lake-lotawana.mo.us/
Also on:    postgresql.org/message-id/45217D8D.7060106@lake-lotawana.mo.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: hook@lake-lotawana.mo.us
  Subject: Re: Time interval sums
  In-Reply-To: <45217D8D.7060106@lake-lotawana.mo.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox