更新 table - 0 行受影响

UPDATE table - 0 rows affected

我写了一个 UPDATE 命令,它的语法很好,但是它不会影响任何行,所以它实际上不起作用。 [1] [1]: https://i.stack.imgur.com/MXinf.png

update T1 c, T2 dk
    set c.date = dk.dates, c.field = 'event_dt'  
where c.id = dk.id and c.age = dk.age and c.height = dk.height and c.country = dk.country
    and c.id is not null and c.date is null and c.age is not null and c.height is not null and c.country is not null;

我该如何解决这个问题? 谢谢!

我建议将其写为更新连接:

UPDATE T1 c
INNER JOIN T2 dk
    ON c.id = dk.id and c.age = dk.age and c.height = dk.height and c.country = dk.country
SET c.date = dk.dates, c.field = 'event_dt'  
WHERE c.id IS NOT NULL AND c.date IS NULL AND c.age IS NOT NULL AND
      c.height IS NOT NULL AND c.country IS NOT NULL;

如果以上也没有更新任何行,那么您的数据或逻辑已关闭。