So I need to count the number of associated entries in a relational database without using an aggregate function. Out current database represents recipes and their ingredients. I need something along the lines of:
SELECT `RecipeId`,`RecipeTitle`, COUNT(`IngredientId`) AS `IngredientCount`
FROM `recipes` Natural Join `recipe_ingredients`
GROUP BY `RecipeID`
HAVING `IngredientCount` < 5
But without using COUNT().
Thank you.