Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WITH RECURSIVE hierarchy (
- SELECT id, 0 AS depth
- FROM pages page
- WHERE page.id = "TYPE_LIST.150"
- UNION ALL
- SELECT id, h.depth+1
- FROM pages next JOIN hierarchy h
- WHERE h.pid = next.id
- )
- SELECT * FROM hierarchy;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement