从table1,table2,table3中删除哪里?

时间:2010-10-07 04:12:21

标签: sql mysql multi-table-delete

如果我要删除的所有表都包含gamer_id列

我可以从table1,table2,table3中删除gamer_id = 123吗?

还是有不同的语法?

1 个答案:

答案 0 :(得分:2)

MySQL支持multi-table deletes

DELETE t1, t2, t3
  FROM TABLE_1 t1
  JOIN TABLE_2 t2 ON t2.gamer_id = t1.gamer_id
  JOIN TABLE_3 t3 ON t3.gamer_id = t1.gamer_id
 WHERE t1.gamer_id = 123