how to sum up a field in queries by month in microsoft access?
I have a query which has one field of numbers and one field of a specific date. I want to sum up the numbers by month, but I don’t know how to do it. can anyone help me?
I have a query which has one field of numbers and one field of a specific date. I want to sum up the numbers by month-year (jan 2004, feb 2004, till present), but I don’t know how to do it. can anyone help me?
In your query, lets say your date field is called startdate and the numbers you want to sum is from a field called credits
the sql for your query will look as follows….
SELECT Month([dates]![startdate]) AS [Month], Sum(dates.credits) AS SumOfcredits
FROM dates
GROUP BY Month([dates]![startdate]);
What this will do is assign a number to the date according to month to a new field called Month, 1 for Jan, 2 for Feb, 3 for march, etc….and then show you the sum of each month
For month and year….
This will work…show the month and then year like this 1-2009
SELECT Month([dates]![startdate]) & "-" & Year([dates]![startdate]) AS MonAndYear, Sum(dates.credits) AS SumOfcredits
FROM dates
GROUP BY Month([dates]![startdate]) & "-" & Year([dates]![startdate]);
I hope this helps
December 22nd, 2009 at 1:34 am
In your query, lets say your date field is called startdate and the numbers you want to sum is from a field called credits
the sql for your query will look as follows….
SELECT Month([dates]![startdate]) AS [Month], Sum(dates.credits) AS SumOfcredits
FROM dates
GROUP BY Month([dates]![startdate]);
What this will do is assign a number to the date according to month to a new field called Month, 1 for Jan, 2 for Feb, 3 for march, etc….and then show you the sum of each month
For month and year….
This will work…show the month and then year like this 1-2009
SELECT Month([dates]![startdate]) & "-" & Year([dates]![startdate]) AS MonAndYear, Sum(dates.credits) AS SumOfcredits
FROM dates
GROUP BY Month([dates]![startdate]) & "-" & Year([dates]![startdate]);
I hope this helps
References :