我有两个表格Image和Note都有Noteid列,所以如何在两个表中删除Noteid = 2 ...我的查询是"delete from Note,Images where Noteid = "2""
但它无法正常工作......
答案 0 :(得分:1)
delete from Note, Images where Noteid = 2
这应该适合你。
答案 1 :(得分:1)
您需要为此创建触发器。
//This will work for you open your databse in any database managers and create this trigger
CREATE TRIGGER Images_delete AFTER DELETE ON Note
FOR EACH ROW
BEGIN
DELETE FROM Images WHERE Noteid = old.Noteid;
END
您只需要从Note表中删除。
欲了解更多信息,请阅读
答案 2 :(得分:0)
您必须编写如下两个查询才能从两个表中删除
DELETE FROM Note WHERE Noteid = '2';
DELETE FROM Images WHERE Noteid = '2';
这可能适合你。