Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3F3C74760B7 for ; Fri, 17 Jan 2003 08:06:28 -0500 (EST) Received: from email06.aon.at (WARSL401PIP3.highway.telekom.at [195.3.96.75]) by postgresql.org (Postfix) with SMTP id EFC28476078 for ; Fri, 17 Jan 2003 08:06:26 -0500 (EST) Received: (qmail 504746 invoked from network); 17 Jan 2003 13:06:29 -0000 Received: from m214p007.dipool.highway.telekom.at (HELO aon.at) ([62.46.16.167]) (envelope-sender ) by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 17 Jan 2003 13:06:29 -0000 Message-ID: <3E27FF37.4060803@aon.at> Date: Fri, 17 Jan 2003 14:03:51 +0100 From: Oliver Vecernik User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1 X-Accept-Language: de, de-de MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: sum(time) problem Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/275 X-Sequence-Number: 11140 Hi all, I've got following table structure: sport=# \d polar Table "polar" Column | Type | Modifiers --------+--------------------------+----------- ts | timestamp with time zone | not null time | time without time zone | sport | integer | default 1 kcal | integer | Primary key: polar_pkey sport=# select * from polar limit 3; ts | time | sport | kcal ------------------------+----------+-------+------ 2001-05-17 19:47:31+02 | 00:28:25 | 1 | 388 2001-05-18 17:08:11+02 | 00:42:36 | 1 | 595 2001-05-19 13:41:43+02 | 00:51:39 | 1 | 737 (3 rows) I'd like to have the total amount of time: sport=# select sum(time) from polar where extract(year from ts)=2001; ERROR: Unable to select an aggregate function sum(time without time zone) It seems I've chosen the wrong type. Or is there another solution? Oliver -- VECERNIK Datenerfassungssysteme A-2560 Hernstein, Hofkogelgasse 17 Tel.: +43 2633 47530, Fax: DW 50 http://members.aon.at/vecernik