I am stuck wit Linq to Sql "NOT IN" - (Solved)
LINQ
1
Posts
1
Posters
3
Views
1
Watching
-
In sql i would do this:
SELECT t.Id
FROM table1 t
WHERE t.Id NOT IN(
SELECT t.Id
FROM table1 t
right join table2 t2
on t.Id = t2.table1_Id
)which returns all the records in
table1
that are not intable2
. I am stumped as to how to convert this to Linq to SQL. Any pointers? [Answer Found] I need to use theExcept
method:var res1 = from t in table1 select t.Id;
var res2 = from t2 in table2 select t2.table1_Id;
var res3 = t.Except(t2);:doh:
I don't speak Idiot - please talk slowly and clearly "I have sexdaily. I mean dyslexia. Fcuk!" Driven to the arms of Heineken by the wife