Query information needed

Поиск
Список
Период
Сортировка
От djzanky@gmail.com
Тема Query information needed
Дата
Msg-id 1129207846.673463.305670@g44g2000cwa.googlegroups.com
обсуждение исходный текст
Ответы Re: Query information needed  (Michael Glaesemann <grzm@myrealbox.com>)
Re: Query information needed  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-sql
Dear all,

I have a table created with this specifications:

CREATE TABLE cdr ( calldate timestamp with time zone NOT NULL default now(), clid varchar(80) NOT NULL default '', src
varchar(80)NOT NULL default '', dst varchar(80) NOT NULL default '', dcontext varchar(80) NOT NULL default '', channel
varchar(80)NOT NULL default '', dstchannel varchar(80) NOT NULL default '', lastapp varchar(80) NOT NULL default '',
lastdatavarchar(80) NOT NULL default '', duration bigint NOT NULL default '0', billsec bigint NOT NULL default '0',
dispositionvarchar(45) NOT NULL default '', amaflags bigint NOT NULL default '0', accountcode varchar(20) NOT NULL
default'', uniqueid varchar(32) NOT NULL default '', userfield varchar(255) NOT NULL default ''
 
);

I want to extract the number of calls placed in 1 hour and the average
call duration

I'm working with this query:

SELECT date_trunc('hour',calldate), duration FROM cdr WHERE src=601
ORDER BY calldate;

i tried several other queries but i'm not able to count the number of
calls in an hour (better in a time interval) and calculate the average
duration.

Any suggestions would be appreciated! Tnx



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Shavonne Marietta Wijesinghe"
Дата:
Сообщение:
Следующее
От: david@fetter.org (David Fetter)
Дата:
Сообщение: Re: generating a sequence table against which to do a LEFT OUTER JOIN