Need magic for a moving statistic

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Need magic for a moving statistic
Date: 2009-10-02 01:06:57
Message-ID: 4AC55231.2080008@gmx.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I need some magic for a moving statistic that works on a rather big
table starting at a given date within the table up until now.
The statistic will count events allways on fridays over periods of 2
weeks before ... biweekly?
So I'd like to get a line every 2 weeks for everthing between.

I sadly don't know how to spell that does:

collect data where insert_date between friday1 and friday1 +
inteval '2 week'
collect data where insert_date between friday1 + inteval '2 week'
+ inteval '1 second' and friday1 + inteval '4 week'
collect data where insert_date between friday1 + inteval '4 week'
+ inteval '1 second' and friday1 + inteval '6 week'

Is this possible ?

regards

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas 2009-10-02 03:52:55 Re: SQL moving window averages/statistics
Previous Message A. Kretschmer 2009-10-01 06:40:21 Re: Can i customize null-padding for outer joins?