I have query that should return results, but doesn't.
First I have an employeeUnitJob table. It has no records in it for this employee:
The query is:
select * from EmployeeUnitJobType where EmployeeId = 159795
It returns no rows as expected.
I want to do a query that returns the employees who have no rows in the employeeunitJobtype table, so I do this query, and just for testing I add the employeeID of this one employee that I know doesn't have a row in the table:
Employee.EmployeeId NOT IN (select EmployeeId from EmployeeUnitJobType)
AND EmployeeId = 159795
But this ALSO returns no rows. as though everyone has a unit/job and this person does not!
Is there something I am doing wrong? Why is the above query NOT returning any rows? it should return this employee?