Suppose I have a structure like this:

Recipes table

RecipeID
Name
Description

RecipeIngredients table

RecipeID
IngredientID
Quantity
UOM

The key on RecipeIngredients is (RecipeID, IngredientID).

What are some good ways for finding duplicate recipes? A duplicate recipe is defined as having the exact same set of ingredients and quantities for each ingredient.

I've thought of using FOR XML PATH to combine the ingredients into a single column. I haven't fully explored this but it should work if I make sure the ingredients/UOMs/quantities are sorted in the same sequence and have a proper separator. Are there better approaches?

There are 48K recipes and 200K ingredient rows.

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 dba.stackexchange
scroll top