我有以下表格:
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;
有没有简单的方法来组合这些查询?
答案 0 :(得分:0)