Possible Duplicate:
“NOT IN” clause in LINQ to Entities
I work with the schema below, and I want to know how I can write in the sql query in LINQ to Entities.
SQL Code:
Select *
FROM GROUEPUSERS G
WHERE G.IDGROUPE NOT IN (SELECT IDGROUPE
FROM APPARTENIR
WHERE IDCLIENT = id)
The ID is a variable that I will recover. The problem is that the table APPARTENIR becomes a navigation table.
I found the solution just in case :
var groups = from g in context.GROUPEUSER
where !g.UTILISATEUR.Select(d => d.ID).Contains(id)
select g;