Last post Jul 27, 2010 01:58 PM by webaspdotnet
Aug 14, 2008 11:46 PM|JennyWren|LINK
How do I do a NOT IN with LINQ? I need to retrieve all records from one table which don't appear in a subset of another table. I'm working in VB. Thanks!
Here's what my SQL would look like:
SELECT * FROM Players WHERE usr_id NOT IN ( SELECT usr_id FROM GroupPlayers WHERE grp_id = '3' )
Aug 15, 2008 12:21 AM|gunteman|LINK
Aug 15, 2008 12:37 AM|tamizhppiriyan|LINK
Something like this...will give u the equivalent of NOT IN
var p1 = from player in Players
where !(from grpPlay in GroupPlayers where grpPlay.grp_id == 3 select grpPlay.usr_id).Contains(player.usr_id)
you can also look at http://programminglinq.com/blogs/marcorusso/archive/2008/01/14/the-not-in-clause-in-linq-to-sql.aspx
Jul 27, 2010 01:57 PM|webaspdotnet|LINK
I have implemnted Same functionality in my project.
See on below link :-
How ever it's implemented for IN operator
Jul 27, 2010 01:58 PM|webaspdotnet|LINK