pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Willem de Jong <Willumpie@xs4all.nl>
Cc: pgsql-sql@postgresql.org
Subject: Re: sum ( time) problem
Date: Tue, 1 Jun 2004 09:03:34 -0500
Message-ID: <20040601140334.GA24188@wolff.to> (raw)
In-Reply-To: <Xns94F687197CDCDJongdatdnaservicesdo@200.46.204.72>
References: <Xns94E7AEA1D11BBJongdatdnaservicesdo@200.46.204.72>
	<1084406549.228484@seven.kulnet.kuleuven.ac.be>
	<Xns94F687197CDCDJongdatdnaservicesdo@200.46.204.72>

On Thu, May 27, 2004 at 11:14:58 +0000,
  Willem de Jong <Willumpie@xs4all.nl> wrote:
> >>
> >> If i do a sum(time) the result is like this '1 day 18:00:00'. But i'd
> >> like to get a result like this '42:00:00'.
> >>
> >> How can i realise is by a query?

You can do something like the following: (not completely tested)
select extract(epoch from sum(time))/3600 || ':' ||
  extract(minutes from sum(time)) || ':' ||
  extract(seconds from sum(time));

I am not sure if the above will work right for negative intervals.



view thread (6+ messages)  latest in thread

Message-ID: <20040601140334.GA24188@wolff.to>
Permalink:  ../20040601140334.GA24188@wolff.to/
Also on:    postgresql.org/message-id/20040601140334.GA24188@wolff.to

 · 

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: bruno@wolff.to, Willumpie@xs4all.nl
  Subject: Re: sum ( time) problem
  In-Reply-To: <20040601140334.GA24188@wolff.to>

* 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