Finding records not in a table
Long time, no post. Anyhoo, I've got a small mySQL problem. I'm cleaning up in the company's internal computer/employee db. I've got two tables, tblPerson and tblPersonComputerLink. tblPerson contains all info on an employee (ID, firstname, lastname, etc.) and tblPersonComputerLInk has two columns, one for personID and one for computerID, for linking a person to a computer.
What I want to do is find the persons who aren't linked to a computer, ie. their ID wouldn't exist in the tblPersonComputerLink table. The best query I've vome up with so far is:
This returns 0 rows, which isn't right, since I know there are people in the table who aren't linked to a computer.
SELECT tblPerson.firstName, tblPerson.lastName, tblPersonComputerLink.personID
FROM tblPerson INNER JOIN tblPersonComputerLink ON tblPerson.employmentNo = tblPersonComputerLink.personID
WHERE tblPerson.employmentNo NOT IN(tblPersonComputerLink.personID)