Last post Jul 27, 2010 08:58 AM by webaspdotnet
Aug 14, 2008 06: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 14, 2008 07:21 PM|gunteman|LINK
Aug 14, 2008 07:37 PM|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 08:57 AM|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 08:58 AM|webaspdotnet|LINK