2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.