I have a problem that I would like have solved via a SQL query. This is going to be used as a PoC (proof of concept).
The problem:
Product offerings are made up of one or many product instances, a product instance can belong to many product offerings. This can be realised like this in a table:
PO | PI ----- A | 10 A | 11 A | 12 B | 10 B | 11 C | 13
Now I would like to get back the product offer from a set of product instances. E.g. if we send in 10,11,13 the expected result back is B & C, and if we send in only 10 then the result should be NULL since no product offering is made up of only 10. Sending in 10,11,12 would result in A (not A & B since 12 is not a valid product offer in it self).
Prerequisites: The combination of product instances sent in can only result in one specific combination of product offerings, so there is only one solution to each query.
Okay, I think I have it. This meets the constraints you provided. There might be a way to simplify this further, but it ate my brain a little:
This yields only results who fill the given set which are disjoint with all other results, which I think is what you were asking for. For the test examples given: