Tree SQL query
Posted on 2002-03-26
I have a table GOODS, for example:
where UP_ID refer to ID.
I can build a tree with query:
SELECT ID, UP_ID, TYPE_ID, NAME, level
FROM GOODS where id<>522
CONNECT BY PRIOR ID = up_id and id not in (2805,10048,14178,14426,14356,16920)
START WITH id=522
sometimes level exceed 7.
If i build a tree like that i will have branches that fork too much. i would
like them to fork no more then three times. for that i will need to somehow manage it.
I need for report all branches with level>3 were placed in this third-level branch.