Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ancestor descendant depth
- 1 1 0
- 1 2 1
- 1 3 1
- 1 4 1
- 2 2 0
- 3 3 0
- 4 4 0
- INSERT INTO closure_tree_path (ancestor, descendant)
- SELECT ancestor, '{$node_id}' FROM closure_tree_path
- WHERE descendant = '{$parent_id}'
- UNION ALL SELECT '{$node_id}', '{$node_id}';
- INSERT INTO closure_tree_path (ancestor, descendant, depth)
- SELECT ancestor, '{$node_id}', depth+1 FROM closure_tree_path
- WHERE descendant = '{$parent_id}'
- UNION ALL SELECT '{$node_id}', '{$node_id}', 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement