convert sum (interval) to seconds

From: Doppelganger <quadratini(at)sni(dot)ph>
To: pgsql-sql(at)postgresql(dot)org
Subject: convert sum (interval) to seconds
Date: 2002-09-03 10:45:33
Message-ID: 1031049935.25016.14.camel@tiger-work.sni.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Oliver Elphick 2002-09-03 11:11:10 Re: convert sum (interval) to seconds
Previous Message Hubert depesz Lubaczewski 2002-09-03 08:41:44 Re: RFC822 Checker