Take the 2-minute tour ×
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 know this question has been asked probably a million times, so please forgive me asking it again. I am not a DBA and have very little knowledge of SQL and Derby, but need some kind of a solution as I am the only one responsible for getting this done:

Recursive query in Apache Derby 10.10 There is a table, storing basically a tree:

+----+-----------+-----+
| id | parent_id | ... |
+----------------------+
| 0  | null      | ... |
| 5  | 0         | ... |
 ......................
| N  | K         | ... |
+----+-----------+-----+

I need to make it look like this:

+----+-----------+-----+
| id | parent_id | ... |
+----------------------+
| 0  | null      | ... |
| 1  | 0         | ... |
| 15 | 1         | ... |
| 16 | 1         | ... |
| 2  | 0         | ... |
| 10 | 2         | ... |
| 11 | 2         | ... |
 ......................
| N  | K         | ... |
+----+-----------+-----+

Or a way to traverse and enumerate the tree in place.

Thank you.

share|improve this question

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.