| From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
|---|---|
| To: | Patrick B <patrickbakerbr(at)gmail(dot)com> |
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Average - Pg 9.2 |
| Date: | 2017-02-03 03:54:01 |
| Message-ID: | CAKFQuwY9296wft2sAUzhGhtjj_1T_6Ur=F6ugBnBePQ1zFmddA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Thursday, February 2, 2017, Patrick B <patrickbakerbr(at)gmail(dot)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
>
> http://sqlfiddle.com/#!15/3289b/1
>
>
Maybe...see GROUP BY...
David J.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jong-won Choi | 2017-02-03 05:24:39 | Row level security policy - calling function for right hand side value of 'in' in using_expression |
| Previous Message | Patrick B | 2017-02-03 03:19:27 | Average - Pg 9.2 |