Average - Pg 9.2

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Average - Pg 9.2
Date: 2017-02-03 03:19:27
Message-ID: CAJNY3iuhVuW=C1ijb-6=ptxLvDfBi+6jwNqcgNUHQfgpG7ZxAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

http://sqlfiddle.com/#!15/3289b/1

Thanks!
Patrick

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2017-02-03 03:54:01 Re: Average - Pg 9.2
Previous Message Michael Paquier 2017-02-03 02:34:36 Re: Synchronous Commit, WAL archiving and statement_timeout