我不明白为什么我的查询在 phpMyAdmin 中运行良好,而在我的 php 脚本中它给我消息:无法在 FROM 子句中指定要更新的目标表!!!
update tableA set
Field1 = round(round((select (select br.FieldA from tableB br where tableA.id=br.id and tableA.id2=br.id2) as x),4) - round(tableA.FieldA,4),4)
最佳答案
没错。您不能在嵌套查询中选择您现在正在更新的同一个表。
更好的解决方案是在您的更新中使用连接。 http://dev.mysql.com/doc/refman/5.5/en/update.html
关于php - 奇怪的 : can't specify target table for update in FROM clause,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4843217/