Advertisement
infogulch

Untitled

Jun 1st, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. INSERT INTO closures (ancestor, descendant, pathlength)
  2. SELECT ancestor, id, pathlength+1
  3. FROM closures
  4. JOIN nodes ON parent_id = descendant
  5.  
  6. UNION ALL
  7.  
  8. SELECT id, id, 0
  9. FROM closures
  10. JOIN nodes ON parent_id = descendant
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement