LINQ Left Join On Not Equal Rows

白昼怎懂夜的黑 提交于 2019-12-05 18:35:24

Well, you could do something like this:

var query = from t1 in table1
            join t2 in table2
            on new { t1.col1, t2.col2} equals { t2.col1, t2.col2 }
            into groups
            where !groups.Any()
            select t1;

Here, groups is the set of rows in t2 which match the "current" t1 - it will be empty if there aren't any groups, which is exactly what you want. The easiest way of checking whether a sequence is empty is to use the Any method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!