I've got two tables with a simple 1:n relation. One table contains ingredients and their availability. The other contains recipes and their respective ingredients.
Table recipes
RecipeA | IngredientA
RecipeA | IngredientB
RecipeB | IngredientA
RecipeB | IngredientC
and table ingredients
IngredientA | true
IngredientB | true
IngredientC | false
Querying all rows of table recipes where the ingredient is available is trivial. But how do I select only recipes where ALL ingredients are available? The result should be
RecipeA
I assume it can be done with the ALL
operator but I didn't succeed yet. I tried without success
SELECT Recipe
FROM tblRecipes
WHERE Ingredient = ALL (
SELECT Ingredient
FROM tblIngredients
WHERE Available
)