Im just new to MySql Programming and Im creating a project to enchance my skills.
I have a table called tblRecipe which has the columns RecipeId, RecipeName and Instructions. the other table is called tblIngredients which has the columns IngredientId,RecipeId, IngredientName.
Now for example,RecipeOne needs IngredientOne and IngredientTwo to make, RecipeTwo needs IngredientOne,IngredientTwo and IngredientThree to make. My programs asks the IngredientNames for the input so when i put in IngredientOne and IngredientTwo it should give me back the result RecipeOne.
Here is my code
Select Recipename,Instructions
from tblREcipe where RecipeId in
(select recipeID
from tblIngredients
where Ingredientname in('IngredientOne','IngredientTWo')
);
I know that the IN operator is like saying match any of the following. So with that code it gives me both recipes. Im looking for an equivalent of AND. I tried "Ingredientname =ALL(in('IngredientOne','IngredientTwo'))" but it does not return any rows.
Im open to any changes such as restructuring the tables if that fixes the problem since this is just a practice project.Hope to hear from you soon guys and thank you in advance.