I'm using Oracle 10.2.0.4 version. I have a database table with the following structure,
CREATE TABLE SOME_TABLE
(
ID NUMBER(10) PRIMARY KEY,
PARENT NUMBER(10)
)
ID PARENT_ID
1 0
2 1
3 1
4 2
5 4
6 4
100 0
Here '0' is root PARENT_ID. Say ID 5's parent is 4 & 4's parent is 2 & 2's parent is 1. How can i frame a SQL select query to which can eventually give me the output as '5/4/2/1' which is the parent hierarchy of ID 5. See the output doesn't contain the root PARENT_ID '0'
Edited by: Vel on Jan 5, 2012 12:20 AM