gpt4 book ai didi

mysql - 使用内部连接查询 mysql 更新时出现语法错误

转载 作者:行者123 更新时间:2023-11-29 00:17:16 25 4
gpt4 key购买 nike

我的查询:

UPDATE i SET i.CurStock = i.CurStock-g.Qty  
FROM inv_inventarymaster AS i INNER JOIN inv_goodsissue AS g
ON i.ItemName = g.ItemName WHERE g.DATE='2014-03-20';

错误:

You have an error in your SQL syntax; check the manual that correspond to your MySQL server version for the right syntax to use near 'FROM inv_inventarymaster as i INNER JOIN inv_goodsissue as g ON ' at line 1

请帮助我获得正确的语法。

最佳答案

试试这个...未测试但作为 MYsql http://dev.mysql.com/doc/refman/5.0/en/update.html

UPDATE inv_inventarymaster AS i INNER JOIN inv_goodsissue AS g SET 
i.CurStock = i.CurStock-g.Qty
WHERE i.ItemName = g.ItemName and g.DATE='2014-03-20';

关于mysql - 使用内部连接查询 mysql 更新时出现语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22526132/

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