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 All开发者_如何转开发ocatedID
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
select empid, name
from employee
where empid not in (select empid from allocatedDetails)
Note this assumes the allocatedid is a deptid
精彩评论