Convert SQL to LINQ to Entities WHERE IN clause

后端 未结 2 1919
无人及你
无人及你 2021-01-29 03:38

How can I convert this sql statetment to LINQ to Entities?

SQL Statement:

Select * from Departments where DepartmentID  in (Select DepartmentID from Empl         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-29 04:10

    (from d in db.Departments
     join e in db.Employees
         on d.DepartmentID equals e.DepartmentID
     where e.FirstName.Contains("FirstName") ||
           e.LastName.Contains("LastName")
     select t).Distinct()
    

提交回复
热议问题