我想删除在另一个表中没有现有外键的所有行
例:
table1
+----+-------+
|id | data |
+----+-------+
| 1 | hi |
+----+-------+
| 2 | hi |
+----+-------+
| 3 | hi |
+----+-------+
| 4 | hi |
+----+-------+
| 5 | hi |
+----+-------+
table2
+----+-------+
|a_id| data |
+----+-------+
| 1 | hi |
+----+-------+
| 20 | hi |
+----+-------+
| 3 | hi |
+----+-------+
| 40 | hi |
+----+-------+
| 5 | hi |
+----+-------+
该查询将删除table2上ID为#20和40的行.
我需要这样做,以便我可以建立与table1和table2的关系.