我想将此sql查询转换为linq:
SELECT Number
FROM Pager
FULL OUTER JOIN Location
ON Pager.PagerId = Location.PagerId
FULL OUTER JOIN PersonCalls
ON Pager.PagerId = PersonCalls.PagerId
FULL OUTER JOIN Activity
ON Pager.PagerId = Activity.PagerId
WHERE (Pager.PagerId IS NULL OR Location.PagerId IS NULL) AND
(Pager.PagerId IS NULL OR PersonCalls.PagerId IS NULL) AND
(Pager.PagerId IS NULL OR Activity.PagerId IS NULL)
这可以正常工作。 但对于linq,我测试了这段代码:
var query = from Activity in db.Activity
from Location in db.Location
from PersonCalls in db.PersonCalls
where
(Activity.Pager.PagerId == null ||
Location.PagerId == null) &&
(Activity.Pager.PagerId == null ||
PersonCalls.PagerId == null) &&
(Activity.Pager.PagerId == null ||
Activity.PagerId == null)
select new {
Activity.Pager.Number
}
给我没有结果!