Re: Sum(time) possible?

From: cbbrowne(at)acm(dot)org
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Sum(time) possible?
Date: 2001-11-03 18:05:43
Message-ID: XlWE7.22539$Fy2.4168861@news20.bellglobal.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

elwood(at)agouros(dot)de (Konstantinos Agouros) writes:
> On Sat, Nov 03, 2001 at 09:33:35AM -0800, Andrew Gould wrote:
> > Are you trying to sum times or lengths of time?

> Yup. A little background the column hold the time someone works on a
> project. At the end of the month I want to see the total time. If
> time is not the right column type for this please let me know.

Well, the TIME field is intended to contain something resembling a
time _stamp_. That's not terribly compatible with your intent.

Trying a little sample:

DROP TABLE samp;
CREATE TABLE samp (
consumed time,
name char(15)
);

insert into samp (consumed, name) values ('11:00', 'chris');
insert into samp (consumed, name) values ('13:00', 'dave');
insert into samp (consumed, name) values ('14:00', 'doug');

select * from samp;
select sum(consumed) from samp;
-->

DROP
CREATE
INSERT 118714 1
INSERT 118715 1
INSERT 118716 1
consumed | name
----------+-----------------
11:00:00 | chris
13:00:00 | dave
14:00:00 | doug
(3 rows)

ERROR: Unable to select an aggregate function sum(time)

Apparently what you want isn't completely well supported :-(.
--
(reverse (concatenate 'string "gro.gultn@" "enworbbc"))
http://www.cbbrowne.com/info/lsf.html
Twice five syllables
Plus seven can't say much but
That's haiku for you.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-11-03 18:10:02 Re: Sum(time) possible?
Previous Message Konstantinos Agouros 2001-11-03 18:02:20 Re: Sum(time) possible?