Обсуждение: [GENERAL] Average - Pg 9.2

Поиск
Список
Период
Сортировка

[GENERAL] Average - Pg 9.2

От
Patrick B
Дата:
Hi guys,

I've got a table which has id and created date columns.

I want to get the average of inserted rows monthly.
How can I get this data?

This query is not working as it is showing me same data in both columns.

select created_date,
AVG(id) 
OVER(ORDER BY created_date) AS avr from test


Thanks!
Patrick

Re: [GENERAL] Average - Pg 9.2

От
"David G. Johnston"
Дата:
On Thursday, February 2, 2017, Patrick B <patrickbakerbr@gmail.com> wrote:
Hi guys,

I've got a table which has id and created date columns.

I want to get the average of inserted rows monthly.
How can I get this data?

This query is not working as it is showing me same data in both columns.

select created_date,
AVG(id) 
OVER(ORDER BY created_date) AS avr from test



Maybe...see GROUP BY...

David J.