Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count number of items by month? 1

Status
Not open for further replies.

osp001

Technical User
Nov 19, 2003
79
US
I've been puzzling over this for a while- I can't figure out how to do it, so some help would be much appreciated!

I have a certain set of items, and each has a date associated with them. Some dates have many items associated with them, some dates have none. Each item has only one date associated with it.

I'd like to count the number of items by month. This is to say, I'd like to know there were X items for the month of January of 2004, Y items with a date in February of 2004, Z items in March, and so forth. It's a simple count, performed on a monthly basis using nothing more than the date field.

Is there a straightforward way to do it with all the items I have? They date back over 5 years now, so it'd be nice to do it in a manner that keeps me from doing it in a tedious fashion. Thanks!
 
It would help if you provided table and field names as well as a sampling of data and desired results.

Try:
SELECT Format([DateField],"yyyymm") as YM, Count(*) As NumOf
FROM tblYourTable
GROUP BY Format([DateField],"yyyymm");

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Sorry to be so vague; sometimes it's good to work things out, rather than have it handed to you. I got it to work- thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top