Answer the question
In order to leave comments, you need to log in
Nested sets how to remove a node and all children?
I found a similar request, but it only removes the node itself, and all child elements remain in their places.
How can a node and all children be removed?
DELETE FROM my_tree WHERE left_key >= $left_key AND right_ key <= $right_key;
UPDATE my_tree SET left_key = IF(left_key > $left_key, left_key – ($right_key - $left_key + 1), left_key), right_key = right_key – ($right_key - $left_key + 1) WHERE right_key > $right_key
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question