General information
Forum:
Microsoft SQL Server
Title:
Group by a varying # of days
Environment versions
SQL Server:
SQL Server 2008
Hello,
I have a standard SQL table holding customer orders. The table has a customerID, an order date, and an order quantity. I would like to create a query that would give me a count of orders and a total amount of orders for 'n' number of days within a date range. For example, I want to see a weekly count (# of days would be 7) for orders for each customer starting Jan 1, 2011 up to today.
I could say that maybe my variable time frames would be weekly, monthly, quarterly or yearly.
Any ideas on how to do this?
TIA
Bob
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only