UPDATE Recipes RE, (
SELECT SUM((((i.iCaseCost/i.iCaseQty)/i.iUnitSize)/i.iUnitSoldBy)*ri.riQty*ri.riMeasureBy) AS 'RecipeCost'
FROM Recipes r INNER JOIN RecipeIngredients ri
ON r.rID = ri.rID JOIN Ingredients i
ON ri.iID = i.iID
WHERE ri.rID = RE.rID
) t
SET RE.rYieldCost = t.RecipeCost
When executed, I get the following error: "Unknown column 'RE.rID' in 'where clause'".
Any ideas?