Matt Greatorex
Registered User.
- Local time
- Today, 10:03
- Joined
- Jun 22, 2005
- Messages
- 1,019
I'm trying to get my head round this query and not having much luck.
I have table that contains. amongst others, two fields I need to use - Date and Amount. I already have a query that returns me the number of entries for a given month, along with the total value.
What I want is to also provide a running total (year to date). Using this:
Combing the two queries works as long as there is only one month. Unfortunately, I'd like to see each month's YTD figure displayed as shown
What I currently get, as you would expect, are the same YTD totals applied to each month:
Probably a fairly straight-forward query for someone with a bit more experience. Any ideas?
I have table that contains. amongst others, two fields I need to use - Date and Amount. I already have a query that returns me the number of entries for a given month, along with the total value.
Code:
SELECT Count(*) AS [Number of Entries],
Sum(NBReferral.[Amount]) AS [Total Amount],
NBReferral.Date
FROM NBReferral
GROUP BY NBReferral.Date;
What I want is to also provide a running total (year to date). Using this:
Code:
SELECT Count(*) AS [YTD Number of Entries],
Sum(NBReferral.[Amtount]) AS [YTD Total Amount]
FROM NBReferral;
Combing the two queries works as long as there is only one month. Unfortunately, I'd like to see each month's YTD figure displayed as shown
Code:
Date Number of Entries Total Amount YTD Number of Entries YTD Total Amount
Nov 2006 5 10000 5 10000
Dec 2006 3 5000 8 15000
Jan 2007 6 12000 14 27000
etc.
Code:
Date Number of Entries Total Amount YTD Number of Entries YTD Total Amount
Nov 2006 5 10000 14 27000
Dec 2006 3 5000 14 27000
Jan 2007 6 12000 14 27000
etc.
Probably a fairly straight-forward query for someone with a bit more experience. Any ideas?