Solved

Query to show employees without training records

Posted on 2014-07-30
5
394 Views
Last Modified: 2014-07-30
I have a training DB that I use to track employee skills and what they were trained on, etc. I have a table called "tblEmployees" where I store the employees. I have a table called "tblTrainingRecords", and then a table called "tblTraining Participants". The tblTrainingRecords is the master table where the training classes are stored. And then the tblTrainingParticipants is where the employees are stored for the classes. What I need to do is find out which employees did not have training for a specified training class. If I store all the employees that had classes in the tblTrainingParticipants, how can I find out which employees did not have training? I hope this makes sense.

Larry
0
Comment
Question by:Lawrence Salvucci
  • 2
  • 2
5 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40230598
try this query, will return all employees without training records

select *
from tblEmployees As E Left Join tblTrainingParticipants As P
On E.EmployeeID=P.EmployeeID
where P.EmployeeID is null
0
 
LVL 1

Author Closing Comment

by:Lawrence Salvucci
ID: 40230607
Thank you very much for your quick response! Much appreciated!!
0
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40230610
select * from tblEmployees where not EmployeeID in
(Select EmployeeID from tblTrainingRecords TR left join
tblTrainingParticipants TP on TR.id=TP.trainingid where
TR.classname='some class') 

Open in new window

This will allow you to specify a class name/description then return all employees that are not registered for that class
0
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40230614
Sorry, thought you wanted a list based on who did not attend a class, not employees that never attended any class..
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 40230621
I do want a list based on who did not attend a class. I was gonna create a query with a criteria selection and use that as table "P" from example Rey gave me. Then I would just make the selection and fire the query example he gave me. Would your example do the same thing but only require one query?
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

685 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