SQL "Not In" Query
Posted on 2015-01-24
I have three tables.
1. Jobs: jobid, jobname, payrate
2. JobAssign: jobid, empID
3. Employees: EmpID, EmpName
The Jobs table contains the details of the jobs. The employee table contains the details of the employees.
The JobAssign tables puts the two together. In some cases and employee can have two jobs. So if I searched JobAssign for a specific ID, I should get all the JobIDs for which that employee is assigned:
select * from Jobs inner join JobAssign on Jobs.Jobid = JobAssign.jobid where JobAssign.EmpId = 1
I'm trying to set it up so I can find all the jobs that an employee has NOT been assigned too.
I can not figure out how to do write the query.
Thanks for your help!!!