sql - What is LINQ operator to perform division operation on Tables? -
to select elements belonging particular group in table, if elements , group type contained in 1 table , group types listed in table perform division on tables. trying linq query perform same operation. please tell me how can perform it?
apparently definition of blog post you'd want intersect , except.
table1.except(table1.intersect(table2));
or rather in case i'd guess
table1.where(d => !table2.any(t => t.type == d.type));
not hard.
i don't think performance can made better, actually. maybe groupby.
table1.groupby(t => t.type).where(g => !table2.any(t => t.type == g.key)).selectmany(g => g);
this should better performance. searches second table every kind of type once, not every row in table1.
Comments
Post a Comment