mysql - SQL Associative Entity question -
I have a SQL question I am working with the following set of table:
< There are 5 dishes in the recipe table, there are many ingredients in the ingredient (52), and the ingredient list is a collaborative unit, whose implementation is between many recipes and ingredient RecipeID and IngredientID essential form. From the auto increment ID number is
I am trying to write a question that displays all vegetarian dishes (which are recipes
'% beef%', '% Pork%' , '% Chicken%', '% lamb%%
in any related constituent). The issue I am raising is that the result set is a line instead of one per line, one recipe per line.
The query that generated this result set (note that the name of the ingredient table is the content here):
select recipe.name AS dish, ingredients.name FROM ( Ingredientlist recipe on recipe mix. Recipe = ingredientlist.recipeid ing ingredientlist contains ingredients. Ingredientid = ingredients.ingredientid) where the ingredients The name '% beef%' and 'ingredients.name' do not like '% chicken%' and 'ingredients.name'. '% Pork%' and 'ingredients.name' are not liked 'lamb%';
This query generates 50 results (not 52, because the two elements are named based on the name of their component. The name that contains the sub-code excluded by my WHERE block ).
My goal is to return 3 preset names out of 3 in the recipe table (subtract those containing meat in related ingredients).
Comments
Post a Comment