need some help on figuring out how to write a query - Mailing list pgsql-general

From Justin
Subject need some help on figuring out how to write a query
Date
Msg-id 47BDEF2B.2050804@emproshunts.com
Whole thread Raw
Responses Re: need some help on figuring out how to write a query
Re: need some help on figuring out how to write a query
List pgsql-general
need to write a query for sales order table where we get the qty order *
price for all line items by week then average then create a moving
Average past 10 weeks of entered sales orders line items.

So what will happen is some one will enter a date range going back 6
month from the present date then query will need to get all the sales
order line items that falls in that date range by week, then average the
first 10 weeks,  drop of the first week moving to the 2nd week to the
11th week to create another average, then drops 2nd week off then moves
3rd week to the 12th week in the query date range create another average
and so  and so till the end of the date range. This will create moving
average for sales order entered.

Now i could write a function to do this or do it in C++ program that
creates query with all kinds of unions.  I'm wondering if there is a way
to create this in a single select statement??
I can't think of a way to do it???

pgsql-general by date:

Previous
From: Geoffrey
Date:
Subject: Re: Disable Triggers
Next
From: Andrew Sullivan
Date:
Subject: Re: Disable Triggers