开发者

SQL query: How can I get the corresponding employee id which are not allotted to department?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜