Reputation: 487
I have Employee
and Department
table. How can I get the corresponding employee id which are not allotted to department?
Employee Table department table AllocatedDetails
EmpID DeptID AllocatedID
Name Name EmpID
Now I have to retrieve the EmpID
which is not in the table AllocatedDetails
.
Can anyone help me please.....
Note: I need SQL query only
Upvotes: 1
Views: 303
Reputation: 3781
select empid, name
from employee
where empid not in (select empid from allocatedDetails)
Note this assumes the allocatedid is a deptid
Upvotes: 1