“Select NOT IN” clause in Linq to Entities

后端 未结 1 604
旧巷少年郎
旧巷少年郎 2020-12-30 01:38

Is there a way to use the \"NOT IN (select XXX...)\" clause in Linq to Entities?
All the questions I found were regarding a list of objects (IN (1,2,3)) but I want to ge

相关标签:
1条回答
  • 2020-12-30 02:05

    Like this:

    from c in db.Customers
    where !db.Products.Any(p => p.ProductID == c.ProductID)
    select c;
    
    0 讨论(0)
提交回复
热议问题