Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by a varying # of days
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01514570
Message ID:
01514572
Vues:
54
This message has been marked as a message which has helped to the initial question of the thread.
Depending on the time frame requested, you would convert an order date into specific interval (week #+year, month+year, quarter+year, or year) and group on it

>
>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.
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform