MySQL:"where子句中的未知列"在更新声明中 [英] MySQL: "Unknown column in where clause" during Update Statement
本文介绍了MySQL:"where子句中的未知列"在更新声明中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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
执行时,出现以下错误:'where子句'中的未知列'RE.rID'".
When executed, I get the following error: "Unknown column 'RE.rID' in 'where clause'".
有什么想法吗?
推荐答案
内部派生查询对外部查询中的列一无所知.尝试使用WHERE t.rID = RE.rID
之类的东西将WHERE移到UPDATE子句中.
Your inner derived query doesn't know anything about columns in the outer query. Try moving the WHERE into the UPDATE clause with something like WHERE t.rID = RE.rID
.
这篇关于MySQL:"where子句中的未知列"在更新声明中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文