我有两张桌子,地址&人。人们有FK来解决。我正试图找到没有人的地址:
select id from Address a
left outer join person p on p.address_id = a.id
where p.address_id is null
这是否可以使用LINQ to Entities?
我尝试了一些变化 var results = from addr in _context.Addresses
from ppl in addr.People
where ppl == null ...
但似乎无法弄清楚如何在没有人的情况下返回地址。
答案 0 :(得分:0)
我建议:
var results = (from addr in _context.Addresses
where !addr.People.Any()
select addr).ToList();