WestCoastHip
asked on
Access SQL Count number of items per month
Hi Experts,
I am new to SQL, and would like to know if there is an easy way to do the following:
I have a table called Builds, and the fields in it are BuildDate, Hull number, ShipType.
I want to make a chart that will plot the number of HullNumbers per month.
So for example, I want to select a range of Months, Say Jan 2010, to May 2010, and get a count of the number of HullNumbers plotted on a line chart . I guess it is like a count of the records per month.
If I have a Chart called chartB, what would the SQL query look like if it was the datasource?
I know this is a pretty simple thing, but I have not had more than a few days with SQL, and am really finding it a little esoteric.
Thanks for your help.
I am new to SQL, and would like to know if there is an easy way to do the following:
I have a table called Builds, and the fields in it are BuildDate, Hull number, ShipType.
I want to make a chart that will plot the number of HullNumbers per month.
So for example, I want to select a range of Months, Say Jan 2010, to May 2010, and get a count of the number of HullNumbers plotted on a line chart . I guess it is like a count of the records per month.
If I have a Chart called chartB, what would the SQL query look like if it was the datasource?
I know this is a pretty simple thing, but I have not had more than a few days with SQL, and am really finding it a little esoteric.
Thanks for your help.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Now one thing I forgot to add is the build date. The date obviously has a day number in it (assuming BuildDate is stored as a date field in the database). In order to extract just the month and year we make use of the format command and specify the strings MMM (for 3 character month) and YYYY (for 4 digit year). If you highlight the Format command then hit F1, it should bring up more info plus a list of other strings to use.
If BuildDate not saved as a date but just text with no day number then remove the Format, just leave it as BuildDate (in both uses SELECT and GROUP BY)
If BuildDate not saved as a date but just text with no day number then remove the Format, just leave it as BuildDate (in both uses SELECT and GROUP BY)
ASKER
Thanks for your help rocki! I appreciate your time, and the more I see the more I am learning.
Thanks again.
Thanks again.
Have a butchers here as it should hopefully help you out http://office.microsoft.com/en-us/access-help/count-data-by-using-a-query-HA010096311.aspx