子查询linq语句,求个答案。 select * from dbo.BaseEmployee left join hrPersInfo
ON BaseEmployee.EmpID =hrPersInfo.EmpID
WHERE BaseEmployee.EmpID NOT IN
( select EmpID from dbo.hrPersInfo) ------解决方案-------------------- from be in db.BaseEmployee
join pi in db.hrPersInfo
on be.EmpID equals pi.EmpID
where db.hrPersInfo.Select(x => x.EmpID).All(x => x != be.EmpID)
or
from be in db.BaseEmployee
join pi in db.hrPersInfo
on be.EmpID equals pi.EmpID
where !db.hrPersInfo.Select(x => x.EmpID).Contians(be.EmpID) ------解决方案--------------------
版主貌似没有加左连接
select * from dbo.BaseEmployee left join hrPersInfo ------解决方案--------------------
from be in db.BaseEmployee
join pi in db.hrPersInfo into NewhrPersInfo
from pi from NewhrPersInfo.DefaultIfEmpty()
on be.EmpID equals pi.EmpID
where db.hrPersInfo.Select(x => x.EmpID).All(x => x != be.EmpID) ------解决方案--------------------
怎么看这SQL语句,都觉得蛋疼~ 你这SQL语句里的left join这句有意义么
var query= from be in BaseEmployee
where !hrPersInfo.Select(h=>h.EmpID).Contains(be.EmpID)
select be;