-1

I ran this query in mysql but it showed an error Unknown table 'table1' in MULTI DELETE. Can anyone guide me on what is wrong please?

DELETE table1, table2,table3, table4
from table1 as t1 
left join table2 as t2
on t1.id = t2.tid 
left join table3 as t3
on t1.id = t3.tid
left jointable4 as t4 
on t1.id = t4.tid 
where t1.id = 77
  • Does this answer your question? [Deleting rows with MySQL LEFT JOIN](https://stackoverflow.com/questions/2763206/deleting-rows-with-mysql-left-join) – Stalinko Sep 24 '21 at 11:10

1 Answers1

1

That's because when you use aliases in multiple delete then you must specify the aliases after DELETE statement:

DELETE t1, t2, t3, t4
from table1 as t1 
left join table2 as t2 on t1.id = t2.tid 
left join table3 as t3 on t1.id = t3.tid
left join table4 as t4 on t1.id = t4.tid 
where t1.id = 77
Stalinko
  • 3,319
  • 28
  • 31