How would I translate the following SQL query in to a comparable LINQ query?
select * from Dept
where Id not in (
Select Id
from Employee
where Salary > 100);
Try something like this:
var result = from d in Dept
let expensiveEmployeeIds = (from e in Employee.Employees
where e.Salary > 100
select e.Id)
where !expensiveEmployeeIds.Contains(d.Id)
select d;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With