SQL "ContainsAll" query

mysql, sql

Solution

I think I finally have a solution. :)

SELECT *
FROM recipeTable r JOIN ingredintsTable i ON r.RecId= i.RecId
WHERE i.IngredientId IN (1,2)
GROUP BY r.id
HAVING ( COUNT(r.id) > 1 )

Problem

I have recipes table and ingredients table and table that connect ingredients to the recipes. I have a list of ingredients, how to write a SELECT statement (or store procedure) that will return a recipes that have ALL given ingredients? How to write this query for MySQL?

Original source