pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Vecernik <vecernik@aon.at>
To: pgsql-sql@postgresql.org
Subject: sum(time) problem
Date: Fri, 17 Jan 2003 14:03:51 +0100
Message-ID: <3E27FF37.4060803@aon.at> (raw)

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





view thread (6+ messages)  latest in thread

Message-ID: <3E27FF37.4060803@aon.at>
Permalink:  ../3E27FF37.4060803@aon.at/
Also on:    postgresql.org/message-id/3E27FF37.4060803@aon.at

 · 

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: vecernik@aon.at
  Subject: Re: sum(time) problem
  In-Reply-To: <3E27FF37.4060803@aon.at>

* 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