The same question actually as this one:
sql: check if entry in table A exists in table B
Here are my tables, Employee and User
SELECT Employee.EmpNo, PositionCode
WHERE NOT EXISTS (SELECT 1
WHERE User.EmpNo= Employee.EmpNo)
I am still not sure what you want. But from my understanding you want distinct
PositionCode which have
EmpNo related to them. If that's what you want you can just select
Distinct PositionCode as below.
SELECT DISTINCT PositionCode FROM Employee WHERE NOT EXISTS (SELECT 1 FROM User WHERE User.EmpNo= Employee.EmpNo)
Let me know if this is not what you are looking for.