Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8E4D79FB215 for ; Mon, 2 Oct 2006 18:12:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 38012-10 for ; Mon, 2 Oct 2006 18:12:02 -0300 (ADT) X-Greylist: delayed 00:05:01.928121 by SQLgrey- Received: from rwcrmhc14.comcast.net (rwcrmhc14.comcast.net [216.148.227.154]) by postgresql.org (Postfix) with ESMTP id 1FCB59FB21B for ; Mon, 2 Oct 2006 18:12:01 -0300 (ADT) Received: from [192.168.1.2] (failure[69.247.213.210]) by comcast.net (rwcrmhc14) with ESMTP id <20061002205904m14005agi4e>; Mon, 2 Oct 2006 20:59:15 +0000 Message-ID: <45217D8D.7060106@lake-lotawana.mo.us> Date: Mon, 02 Oct 2006 15:58:53 -0500 From: "A. R. Van Hook" User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: General Postgresql List Subject: Time interval sums Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/7 X-Sequence-Number: 26396 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