You're right, you can't do this with joins alone. What you want here is an aggregate function, where you select all the recipes and join on to all the ingredients in those recipes, then use something to perform calculations on the *result* of the join. The manual page you want is probably this one: https://dev.mysql.com/doc/refman/5.6/en/group-by-functions.html and you should "group by" the recipe and add the list of ingredients as multiple "having" clauses. Hopefully that gets you started.