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 Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query to total for the month

Status
Not open for further replies.

kdoran

Technical User
Mar 23, 2003
88
US
Ok I have been running a query off the date (for weekly, monthly, yearly checks) for an entry to find out if techs are doing there calibration checks for a certain area.

What I am finding is that if you calibrate a piece of equipment twice in one month it shows up twice and causes the total to be over the actual number of checks.

What I am asking help on is this;

Lets say there are 50 motors that have to be checked monthly. When the tech enters the found data there is a date field and notes field (I can have more if needed). Is there a better way to query that they did the checks for the month other than the date? I am open to any ideas.

There are also checks that have to be done weekly and yearly etc..

Thanks in advance,

Kelly
 
What's the query you're using now that shows the duplicates? What is the data that is returned using this query? What results do you want to see from the query?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 
Far as I know, DateTime fields are really the only way to identify calendar positions ... although you could store things like the month number or year number in a numeric field.

Your issue seems to be that you want to count the number of calibrations done in a month but you also want to count each motor only once even if more than one calibration was done on it. Is that right?
Code:
Select Count(*) As [Calibrations]

From

(Select DISTINCT MotorID From tblCalibrations
 Where [CalibrationDate] BETWEEN [Start Date] AND [End Date])

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top