You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
763 B

SELECT ingredient.ingredient_name, ingredient.ingredient_has_alcohol
FROM flavours_without_borders.user_follows_diet
JOIN flavours_without_borders.diet
ON user_follows_diet.diet_id = diet.diet_id
JOIN flavours_without_borders.diet_prohibits_ingredient
ON diet.diet_id = diet_prohibits_ingredient.diet_id
JOIN flavours_without_borders.ingredient
ON diet_prohibits_ingredient.ingredient_name = ingredient.ingredient_name
WHERE user_follows_diet.user_id = 12
UNION
SELECT ingredient.ingredient_name, ingredient.ingredient_has_alcohol
FROM flavours_without_borders.user_prohibits_ingredient
JOIN flavours_without_borders.ingredient
ON user_prohibits_ingredient.ingredient_name = ingredient.ingredient_name
WHERE user_prohibits_ingredient.user_id = 12