Select records that does not exist in another table in Entity Framework

前端 未结 3 1758
情深已故
情深已故 2020-12-15 03:48

I have two tables - \"Customer\" table and \"Blacklist\" customer table. When I blacklist a customer, I put the customerid as a foreign key to Blacklist table.

What

3条回答
  •  隐瞒了意图╮
    2020-12-15 04:55

    How about something like this:

    var subselect = (from b in BlackList select b.CusId).ToList();
    
    var result = from c in Customer where !subselect.Contains(c.CusId) select c;
    

提交回复
热议问题