Distinct employee training query

G

gameguru365

I need a query that will show the distinct number of employees trained
between a specific time period. The three tables involved, showing only the
relative information, are:

Employee
-------------
Emp ID (PK)
Emp First Name
Emp Last Name

Class Attendance
-------------------
Emp ID (PK)
Class ID (PK)
Date (PK)

Class
 
M

mscertified

SELECT COUNT(*) FROM (SELECT Distinct E.EmpID FROM Employee As E,
ClassAttendance As A WHERE E.EmpID= A.EmpID AND A.Date Between #1/1/06# AND
#3/1/06#)

Dorian
 
J

John Spencer

Since your Table names and field names have a space in the names, you will
need to use two queries to accomplish your goal

QDistinct
SELECT Distinct[Emp ID]
FROM [Class Attendance]
WHERE [Class Attendance].Date Between #1/1/06# and #6/30/06#

Use the above saved query to get the count
SELECT Count(*)
FROM QDistinct

OR visit the following URL

ECount() - an extended DCount()
at:
http://allenbrowne.com/ser-66.html

ECount() takes the same arguments as DCount(), but an extra flag you can set
to retrieve the distinct count.

Once you have copied the code into a module, you should be able to use the
following to get the result you want.
ECount("[Emp id]","[Class Attendance]","Date Between #1/1/06# and
#6/30/06#",True)
 
G

gameguru365

Thank you both for your assistance!

Both ways worked marvelously - with the same result.

Very much appreciated ^_^
 

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