Tell me more ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a table with tree data as it defined in this question and have to implement traversal of the tree that looks like preorder traversal but instead of root --> left subtree --> right subtree should be root --> 1-st subtree --> 2-nd subtree --> 3-rd subtree --> ... where order of subtrees is controlled by column SortOrder that displays 'local' order. For example if we have following data

id    parentId   sortOrder   
----------------------------
1        NULL       1       
2        NULL       2       
3         1         1       
4         1         2       
5        NULL       3       
6         3         1       
7         5         1       

the resulted order should be 1-3-6-4-2-5-7

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.