|
-
sql query - totals by week
Hi there, Can anyone give me a pointer in the right direction on how to tackle this problem. Basically i want to print out totals for all the weeks going back and the dates their from, from a table but im hitting a brick wall. i can get the totals going back seven days but i kinda want it as a rolling loop to the start of the table. and im not sure how to do this showing the dates as well
SELECT DISTINCTROW Format$(Carpark.EntryTime,'Long Date') AS [EntryTime By Day], Sum(Carpark.Bill) AS SumOfBill, COUNT(Carpark.CustomerID) AS NumberOfCars
FROM Carpark
WHERE ((DateDiff("d",Carpark.EntryTime,Now()))<=7)
GROUP BY Format$(Carpark.EntryTime,'Long Date');
this is how i do it for daily totals going back seven days, how could i change this to weekly. Thanks for any help -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks