Michael Fowler
asked on
SQL Help - Find Employee_id in one table where it does not exist in a second table with a specified authy_type
I have two tables MSF810 and MSF872.
MSF810 stores emploee details such as EMPLOYEE_ID,SURNAME,FIRST_ NAME etc
MSF872 stores the authorities each employee has on the system. Each employee has one entry in MSF872 for each authority they have and so each employee may have up to 12 entries in the MSF872
MSF810.EMPLOYEE_ID is equal to MSF872.POSITION_ID
I am trying to get EMPLOYEE_ID,SURNAME,FIRST_ NAME from MSF810 where there is no entry in MSF872 for that employee with the AUTHTY_TYPE = 'WOAU' or AUTHTY_TYPE = 'WORI' in MSF872
Michael
MSF810 stores emploee details such as EMPLOYEE_ID,SURNAME,FIRST_
MSF872 stores the authorities each employee has on the system. Each employee has one entry in MSF872 for each authority they have and so each employee may have up to 12 entries in the MSF872
MSF810.EMPLOYEE_ID is equal to MSF872.POSITION_ID
I am trying to get EMPLOYEE_ID,SURNAME,FIRST_
Michael
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to help even if from a tiny keyboard.
ASKER
thank you
here is the completed solution
Select EMPLOYEE_ID,SURNAME,FIRST_
from MSF810 where not exists (
select POSITION_ID
from MSF872
where AUTHTY_TYPE in ('WOAU','WORI') And MSF810 .EMPLOYEE_ID=MSF872 .POSITION_ID)
Michael