[Solved] How to write a Linq to entity statement, using sql not in operator [duplicate]
You can write something like that: var query = myEntities.Groupeusers .Where(gu => !myEntities.Utilisateur.Any(ut => ut.idgroupe == gu.idgroupe)).ToList(); That should work. EDIT: Try that query instead: var query = myEntities.Groupeusers .Where(gu => !myEntities.Utilisateur .SelectMany(ut=>ut.Groupeuser) .Any(gu => gu.Idgroupe == gu.Idgroupe)).ToList(); OR maybe even better: var query = myEntities.GroupeUsers .Except(myEntities.Utilisateur.SelectMany(ut => ut.Groupeuser)) .ToList(); EDIT2: If I understand your … Read more