I have three tables like this (simplified version):
Object
---------------
ID | ObjectName
---------------
Category
-----------------
ID | CategoryCode
-----------------
ObjectCategory
---------------------
ObjectID | CategoryID
---------------------
How can I select ObjectName
and CategoryCode
for all objects who don't belong to certain CategoryCode
s? I can't just add a WHERE
clause to the JOIN
ed query on all three tables as it will ignore the intended restriction as long as an object belongs to at least one allowed CategoryCode
.
EDIT: I also need to select CategoryCode
from Category
table, a select only on Object
table is not enough