gpt4 book ai didi

mysql - SQL语法错误: 'FROM table_A INNER JOIN table_B ON table_A.name = table_B.name' at line 1

转载 作者:行者123 更新时间:2023-11-29 19:15:49 25 4
gpt4 key购买 nike

我收到一条错误消息“您的 SQL 语法有错误;请检查与您的 MySQL 服务器版本相对应的手册,了解在 'FROM table_A INNER JOIN table_B ON table_A.name = table_B 附近使用的正确语法” .name' 在第 1 行“

sql 查询是:

$sql="UPDATE table_A SET table_A.quantity = table_A.quantity -  
table_B.quantity FROM table_A INNER JOIN table_B ON table_A.name = table_B.name
WHERE table_B.status = 'APPROVED'";

请帮我解决这个错误。谢谢。

最佳答案

“INNER”应为“INNER JOIN”

我认为你还必须从“SET数量”中取出“table_A”

 $sql="UPDATE table_A SET quantity = table_A.quantity -  
table_B.quantity FROM table_A INNER JOIN table_B ON table_A.name = table_B.name
WHERE table_B.status = 'APPROVED'";

关于mysql - SQL语法错误: 'FROM table_A INNER JOIN table_B ON table_A.name = table_B.name' at line 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42726717/

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