当前位置: 代码迷 >> 综合 >> Linq select 不包含
  详细解决方案

Linq select 不包含

热度:33   发布时间:2024-01-21 22:58:10.0

 

table1                       table2
id   name class      id   name class      
1   a        数学      1   a        地理
2   b        英语      2   b        化学
3   c        语文      3   c        语文
4   d        物理  
查出table1中name不在table2的name中出现的数据
结果为
4   d        物理

 

解决方法:

 

from p in table1 where !(from z in table2 select z.id).Contains(p.id)select p

  相关解决方案