I have two table categories ( hierarchical structure ) and attachment that have relations together.
delete from category where lft between @left and @right;
and I want to delete from attachment which is related by those category !
What should I do?
Try:
delete c,a category c
join attachment a on c.id=a.category_id
where c.lft between @left and @right