Count by Month

  • Thread starter Thread starter NotGood@All
  • Start date Start date
N

NotGood@All

I have a query that gives me totals by date. I would like to ge the totals
by month but the field is a date field (12/12/2008). How would I remove the
day and get a count of how many for Dec 2008?

Thanks
 
Presumably your query currently is something like:

SELECT MyDateField, Count(*)
FROM MyTable
GROUP BY MyDateField

Change that to

SELECT Format(MyDateField, "yyyy\-mm"), Count(*)
FROM MyTable
GROUP BY Format(MyDateField, "yyyy\-mm")

or, for a single month only

SELECT "Dec 2008", Count(*)
FROM MyTable
WHERE MyDateField BETWEEN #2008-12-01# AND #2008-12-31#
 
Pete, thank you for responding. What I want to do is get a total by month, I
have a query that gives me totals by day (12/24/2008) =3 and so on. What I
want to do is use this query, take out the 24 and get a total by month
12/2008 = 45
 
Sorry I didn't respond, for some reason my flag on this didn't stick so I
did not see you responded. Anyway, Doug answered.
 
Back
Top