我想通过其他表的外键来更新一个表。
我正在尝试做这样的事情:
UPDATE tbl_1
SET field1 = 6, field12 = NULL
WHERE field3 = (SELECT tbl_2.item1
FROM tbl_1, tbl_2
WHERE tbl_1.field3 = tbl_2.item1 AND tbl_2.item2 = 135)
或
UPDATE tbl_1
SET field1 = 6, field12 = NULL
WHERE field3 = (SELECT item1 FROM tbl_2 WHERE item2 = 135)
WHERE Field3 = (SELECT...
改为WHERE Field3 IN (SELECT ...
,而在第一个问题中,我认为你需要将WHERE Field3 = (SELECT..
改为WHERE EXISTS (SELECT ...
)。 - GarethD