Need magic for a moving statistic - Mailing list pgsql-sql

From Andreas
Subject Need magic for a moving statistic
Date
Msg-id 4AC55231.2080008@gmx.net
Whole thread Raw
Responses Re: Need magic for a moving statistic  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List 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



pgsql-sql by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Can i customize null-padding for outer joins?
Next
From: Andreas
Date:
Subject: Re: SQL moving window averages/statistics