pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Doppelganger <quadratini@sni.ph>
To: pgsql-sql@postgresql.org
Subject: convert sum (interval) to seconds
Date: 03 Sep 2002 18:45:33 +0800
Message-ID: <1031049935.25016.14.camel@tiger-work.sni.ph> (raw)

How can I convert sum(interval) to seconds?


select sum(interval_field) from tablename where condition=condition;

ID  |  LOGIN  | INTERVAL
--------------------------
1   |  JOHN   |  00:00:18
2   |  JOHN   |  00:45:10

If I say, 
select sum(interval) from tablename where login='john';
it will give me 00:45:28 (That's 45 mins, and 28 secs).
How can I convert that to seconds? Can I possibly do it
in just one query? Thank you




view thread (3+ messages)  latest in thread

Message-ID: <1031049935.25016.14.camel@tiger-work.sni.ph>
Permalink:  ../1031049935.25016.14.camel@tiger-work.sni.ph/
Also on:    postgresql.org/message-id/1031049935.25016.14.camel@tiger-work.sni.ph

 · 

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: quadratini@sni.ph
  Subject: Re: convert sum (interval) to seconds
  In-Reply-To: <1031049935.25016.14.camel@tiger-work.sni.ph>

* 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