如果我要删除的所有表都包含gamer_id列
我可以从table1,table2,table3中删除gamer_id = 123吗?
还是有不同的语法?
答案 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