MySQL delete row from multiple tables

后端 未结 3 1056
借酒劲吻你
借酒劲吻你 2020-12-01 17:46

Is this the correct way to do it?

DELETE t1, t2, t3, t4 FROM 
  table1 as t1 
  INNER JOIN  table2 as t2 on t1.id = t2.id
  INNER JOIN  table3 as t3 on t1.id         


        
3条回答
  •  执念已碎
    2020-12-01 18:03

    Make it simple with:

    DELETE FROM `Table1` t1, `Table2` t2 USING t1, t2
    WHERE t1.`id` =  t2.`id` AND t1.`id` = 10; 

    Enjoy :)

提交回复
热议问题