如何在SQLite上连接表时进行更新?我试过:UPDATE closure JOIN item ON ( item_id = id ) SET checked = 0 WHERE ancestor_id = 1以及:UPDATE closure, item
SET checked = 0 WHERE ancestor_id = 1 AND item_id = id这两种方法都适用于MySQL,但这给我带来了SQLite中的语法错误。如何使此更新/连接与SQLite版本3.5.9一起工作?
3 回答
冉冉说
TA贡献1877条经验 获得超1个赞
UPDATE closure SET checked = 0 WHERE item_id IN (SELECT id FROM item WHERE ancestor_id = 1);
幕布斯7119047
TA贡献1794条经验 获得超8个赞
REPLACE INTO clusure SELECT sel.col1,sel.col2,....,sel.checked --checked should correspond to column that you want to changeFROM ( SELECT *,0 as checked FROM closure LEFT JOIN item ON (item_id = id) WHERE ancestor_id = 1) sel
添加回答
举报
0/150
提交
取消