gpt4 book ai didi

php - 奇怪的 : can't specify target table for update in FROM clause

转载 作者:太空宇宙 更新时间:2023-11-03 11:16:13 24 4
gpt4 key购买 nike

我不明白为什么我的查询在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com