MySQL – DELETE JOIN
The delete join function in MySQL is used to delete records from one table and their corresponding records from another table. A match between records or rows in a join statement depends entirely on the type of join we apply in our query. For instance, whether we are performing an inner join, outer join, or full join.
DELETE JOIN with INNER JOIN
In order to remove rows from one table and the matching rows from the other table that satisfy the specified condition, an Inner Join query can be used with a Delete query.
Syntax:
DELETE target table FROM table1 INNER JOIN table2 ON table1.joining_column= table2.joining_column WHERE condition
Example:
DELETE employees, dept_emp FROM employees INNER JOIN dept_emp ON employees.emp_no=dept_emp.emp_no WHERE employees.emp_no = 1100;