Reputation: 173
I have created a query which sums up the interval for respective date-time,
select sum(ts_polling) / count(ts_polling) as Average_Queue_Wait_Time , cast(time_start AS Date)
from callcent_queuecalls group by cast(time_start AS date) order by time_start DESC;
Is there a way to convert Average_Queue_Wait_Time from interval data type to number ?
Upvotes: 3
Views: 17031
Reputation: 246033
You can get the number of seconds in an interval like this:
SELECT EXTRACT(epoch FROM INTERVAL '1 day 30 minutes 1.234 seconds');
┌───────────┐
│ date_part │
├───────────┤
│ 88201.234 │
└───────────┘
(1 row)
Upvotes: 8