Hi everyone,
I have a many-to-many relationship, in which I query all M which have a specific N, for example:
SELECT M.* FROM M INNER JOIN ManyToManyTable
ON M.Id = ManyToManyTable.M
WHERE ManyToManyTable.N = @Id
Or:
SELECT M.* FROM M INNER JOIN ManyToManyTable
ON M.Id = ManyToManyTable.M
INNER JOIN N
ON N.Id = ManyToManyTable.N
WHERE N.Id = @Id
My question is, how to efficiently inverse the query so I get all M which do not have a specific N?
That is, like a NOT IN
the selects above, but without the NOT IN
statement, if possible.