Hi Sider89,
Try this code. it works.
With Family As
(
Select s.ID as aid, null as parentid,s.ID as mainparentid, 0 as Depth
From tree s Where ID = 1
Union All
Select s2.ID, s2.ParentId,mainparentid, Depth + 1
From tree s2
Join Family
On Family.aID = s2.ParentId )
delete t From Family f join tree t on f.aid=t.id