I am trying to display rows that do not exist from another table using LINQ. can someone help me?
It uses sql im.
select * from table1
left join table2
on
table1.col1 = table2.col1
and
table1.col2 = table2.col2
where
table2.col1 is null and table2.col2 is null
Already searched and found some solution. Here is what I have done so far.
from t1 in table1
where
!(from t2 in table1
join t3 in table2 on
new { t2.col1, t2.col2 }
equals
new { t3.col1, t3.col2 }
select t2.PK).Contains(t1.PK)
select t1
The above code works well, but they are just wondering if this is the only solution I can use? I mean, instead of using the JOIN and CONTAINS method, can we use linux linux directly with the where clause?
source
share