I have a products table and a categories table. The categories have a parent-child hierarchy with only 2 levels (parent and child). Products can be associated with many categories via table PC.
How can I find all products that have a parent category but no child from that same parent?
Could look like this:
“Find all products with a category that has a child (= parent category) where no child of this category is linked to the same product.”
This assumes that the parent-child relation is implemented with a single column in the table
category:If you were a nicer guy, you would have specified all that in the question.