Mysql sql更新不起作用

Mysql sql更新不起作用,mysql,sql,sql-update,Mysql,Sql,Sql Update,这很有效 SELECT * FROM productinfo a WHERE NOT EXISTS(SELECT NULL FROM productinfo_temp b WHERE a.ProductID = b.ProductID) 但是,它希望根据该结果更新productinfo表 UPDATE a SET Deleted = '1' FROM productinfo a WHERE

这很有效

SELECT * FROM productinfo a 
WHERE NOT EXISTS(SELECT NULL 
                FROM productinfo_temp b 
                            WHERE a.ProductID = b.ProductID)
但是,它希望根据该结果更新productinfo表

UPDATE a SET Deleted = '1' FROM productinfo a 
    WHERE NOT EXISTS(SELECT NULL 
                    FROM productinfo_temp b 
                                WHERE a.ProductID = b.ProductID)
但它不起作用。 更新有什么问题? 这是一个错误

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM productinfo a WHERE NOT EXISTS(SELECT NULL FROM productinfo' at line 1
尝试:

尝试:

从子句中删除

UPDATE productinfo a 
SET Deleted = '1'
WHERE NOT EXISTS(SELECT NULL 
                 FROM productinfo_temp b 
                 WHERE a.ProductID = b.ProductID)

或者只需使用
左连接

UPDATE  productinfo a 
        LEFT JOIN productinfo_temp b 
            ON a.ProductID = b.ProductID
SET     a.Deleted = 1
WHERE   b.ProductID IS NULL

子句中删除

UPDATE productinfo a 
SET Deleted = '1'
WHERE NOT EXISTS(SELECT NULL 
                 FROM productinfo_temp b 
                 WHERE a.ProductID = b.ProductID)

或者只需使用
左连接

UPDATE  productinfo a 
        LEFT JOIN productinfo_temp b 
            ON a.ProductID = b.ProductID
SET     a.Deleted = 1
WHERE   b.ProductID IS NULL
我也要进去了

UPDATE a SET Deleted = '1'
WHERE NOT EXISTS(SELECT NULL 
FROM productinfo_temp  b
WHERE a.ProductID = b.ProductID)
我也要进去了

UPDATE a SET Deleted = '1'
WHERE NOT EXISTS(SELECT NULL 
FROM productinfo_temp  b
WHERE a.ProductID = b.ProductID)