delete a from table1 a inner join table2 b on a.id=b.id
Delete from table where id in (select id from table2)