我有以下表格:
schools
--------
id | school_name
1 harvy
2 iltes
school_tags
-----------
id | tag_id | school_id
i abc 1
2 def 2
我有以下表格,我想删除学校 id = 2。但它在 school_tags 中有外键。我可以使用单个查询删除它,例如:
delete from school_tags where school_id = 2;
然后
delete from schools where id = 2;
有没有一种简单的方法来组合这些查询?
最佳答案
关于mysql - 组合查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26969339/