Re: Sum(time) possible?

From: "Command Prompt, Inc(dot)" <pgsql-general(at)commandprompt(dot)com>
To: Konstantinos Agouros <elwood(at)agouros(dot)de>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sum(time) possible?
Date: 2001-11-03 17:57:06
Message-ID: Pine.LNX.4.30.0111030954570.25287-100000@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 3 Nov 2001, Konstantinos Agouros wrote:
>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.

Sounds like you want an interval data type, not time. Interval describes a
discrete length of time in temporal units, and you can perform a sum() on
its values.

You could possibly instead have a start_timestamp column and an
end_timestamp column, and do a sum(end_timestamp - start_timetstamp), if
you need to track more than just the interval; subtracting a timestamp
from another timestamp will yield an interval.

Regards,
Jw.
--
jlx(at)commandprompt(dot)com
by way of pgsql-general(at)commandprompt(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2001-11-03 17:57:24 Re: Sum(time) possible?
Previous Message Command Prompt, Inc. 2001-11-03 17:54:20 CREATE TYPE delimiter?