I want to execute the query in sql where i want to get the employees which are not in the department in Dept_id=4,
In SQL
Select emp.ID,emp.First_Name,
from Employee emp
where not exists (select * from Department where Dept_id=4)
order by emp.ID
In LINQ
var employeesNotEnteredList = (from emps in reslandentity.EMPLOYEE
where reslandentity.DEPARTMENT.Any(m=>m.Dept_id!=4)
select emps).Distinct().ToList();
That's it so simple..!!
No comments:
Post a Comment