in reply to Trees in SQL, adjacency lists and sorting.

If you want ordered traversal, I'd add an 'order' column with sibling order, analogous to the depth column. Add a row ('a','a',0,0). select node_id from tree where ancestor='a' order by depth,order;
  • Comment on Re: Trees in SQL, adjacency lists and sorting.