Count by Month

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
 
D

Douglas J. Steele

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#
 
N

NotGood@All

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
 
P

Pete D.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top