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

Query that list what isnt

Status
Not open for further replies.

Demon36

Technical User
Jun 9, 2001
7
US
I have to create a query that list Emp. who have not recieved training. My tables and fields are listed.
Employee Training Courses
Emp.# emp.# course#
name course# course length
dept corse date

How do I just list the ones that dont have training, I have refertial entegrity enforced on relationships also.
 
Try this
Select Employee.Emp.#,Employee.name, Employee.dept, Training.Emp.#
FROM Employee INNER JOIN Training ON Employee.Emp.# = Training.Emp.#
WHERE Training.Course# = Null;
 
This will list employees with no training record at all.

Select * From Employee
Where [Emp.#] Not In (Select [Emp.#] From Training)

The next query will list the courses that Employees have not taken.

Select e.[Emp.#], e.[Name], c.[Course#] As CourseNotTaken
From Employee As e, Courses As c
Where Exists
(Select * From Training
Where [Emp.#] = e.[Emp.#]
And [Course#] = c.[Course#]) = False

Hope this helps. Terry
_____________________________________
Man's mind stretched to a new idea never goes back to its original dimensions. - Oliver Wendell Holmes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top