linq中没有类似sql 中的notin ,事实上很多时候都会用到,可以通过下面方式来实现notin的功能
from a in TableA where !(from b in TableB Where ... select b.Id).Contains(a.Id)
生成出来的语句并非跟not in 完全一样的,而是用not exists(...),不过效果完全相同,
linq中没有类似sql 中的notin ,事实上很多时候都会用到,可以通过下面方式来实现notin的功能
from a in TableA where !(from b in TableB Where ... select b.Id).Contains(a.Id)
生成出来的语句并非跟not in 完全一样的,而是用not exists(...),不过效果完全相同,