Skip to content
Advertisement

How can I make a query that return only the exact list of parameters

I have a table that has the ingredient information and I would like to return only if the value is exactly as the parameter I receive.

The Table structure is:

and if the user inform the ingredient X, the query should not return, but if the user inform X and Y, the query should return Recipe1. If Ingredient X and Z are informed, it should not return too.

can anyone help with this query?

Advertisement

Answer

You can use conditional aggregation:

The conditions test that all the ingredients are in the recipe and that no other ingredients are.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement