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';
您的SQL语法有错误;检查对应的手册 到您的MySQL服务器版本,以便在' FROM附近使用正确的语法 inv_inventarymaster as i INNER JOIN inv_goodsissue as g ON'在第1行
请帮助我找到正确的语法。
答案 0 :(得分: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';
答案 1 :(得分:0)
在Mysql FROM
查询中使用UPDATE
不正确。
您可以使用此类查询
UPDATE inv_inventarymaster AS i
INNER JOIN inv_goodsissue AS g ON i.ItemName = g.ItemName
SET i.CurStock = i.CurStock-g.Qty
WHERE g.DATE='2014-03-20';