带有连接的 informix 更新查询

informix update query with joins

我正在尝试使用另一个 table 中存在的值更新 table 的一个字段,但它给出“201:发生语法错误”。

UPDATE  altr_destination
SET     ad.store_num = sx.new_store_num
FROM    altr_destination ad ,   store_xref sx
WHERE   ad.store_num = sx.old_store_num 
AND     ad.store_num = 9999 ;

谢谢, 乌特卡什

不要使用隐式连接语法(逗号分隔),使用正确的连接语法!

也可以通过相关子查询来完成:

UPDATE  altr_destination ad
SET     ad.store_num =(SELECT sx.new_store_num
                       FROM store_xref sx
                       WHERE   ad.store_num = sx.old_store_num)
WHERE ad.store_num = 9999 ;

我认为 update with join 不适用于旧版本的 informix ,至少我在寻找它时看到的是这样。