Linq Not in
DataTable:
t:
id WR WR1
0 W01 W01
1 W02 null
2 W03 W03
3 W03 null
4 null null
查询 WR1中没有的WR:也就是
select WR from t
where WR not in (select WR1 from t)
用Linq怎么实现?
[解决办法]
- C# code
var query=from dt in t.AsEnumerable() where !t.AsEnumerable().Select(x=>x.Field<string>("WR1")).Contains(dt.Field<string>("WR")) select dt.Field<string>("WR");