need some help on figuring out how to write a query
От | Justin |
---|---|
Тема | need some help on figuring out how to write a query |
Дата | |
Msg-id | 47BDEF2B.2050804@emproshunts.com обсуждение исходный текст |
Ответы |
Re: need some help on figuring out how to write a query
Re: need some help on figuring out how to write a query |
Список | 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 по дате отправления: