[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Access SQL Count number of items per month

Posted on 2010-11-08
4
Medium Priority
?
1,048 Views
Last Modified: 2012-05-10
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.
0
Comment
Question by:WestCoastHip
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 2000 total points
ID: 34089699
you could try something like this

SELECT COUNT(HullNumbers) AS TotalHullNumbers, Format(BuildDate,"MMM YYYY")
FROM Builds
GROUP BY Format(BuildDate,"MMM YYYY")


Create a new query in masaccess, go to sql view and paste this

Because we use COUNT we have to group all other fields
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 34089703
Since your new to SQL, it might be a good idea to use the SQL wizard.

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

0
 
LVL 65

Expert Comment

by:rockiroads
ID: 34089709
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)
0
 

Author Closing Comment

by:WestCoastHip
ID: 34089719
Thanks for your help rocki! I appreciate your time, and the more I see the more I am learning.

Thanks again.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question