Question

Locked

SQL Query - Grouping Sales In Rolling 10 Day Increments

By cliff_hand ·
I've been asked to go thru our last 6 months of sales, by day, and get a rolling average by 10 day increment to graph trends. We only one table with product name and date sold in it. Any ideas? It's probably simple to most, butI've never grouped like this before.

Thanks in advance.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Collapse -

Easy in Excel, but possible in SQL

by JonoMck In reply to SQL Query - Grouping Sale ...

Easy in Excel, but possible in SQL, something like the code below shoud do what you want. Ugly but it works

select
date,
(select sum(sales) from Sales_table as t1
where DATEDIFF(day,t1.date,t.date) between 0 and 9
and " any other join details)/10 as aver sales
from Sales_table as t

Collapse -

SQL Query - Grouping Sales In Rolling 10 Day Increments

by cliff_hand In reply to Easy in Excel, but possib ...

JonoMck,

Thank you for the effort. I will try to carve something up in SQL with what you have above. I was concerned because I had not rec'd any posts on the question. On the flip side, I was relieved that, apparently, no 'experts' knew how to do it either. Or, if they do, they just haven't taken the time to respond.

If anybody else happens to read this, I'm open to any other suggestions, too.

Thanks

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums