-
i have table whose structure and whose datas are as follows
PARENT_ID CHILD_ID
___________________
1 222
3 41
5 16
5 20
7 3
41 90
90 01
what i want the query to be so that when i enter the top most parent all the related child should be displayed
ie supposing if enter 3 the o/p should be
_________
child_id
_________
41
90
01
thanking in anticipation
Aniruddha Gupta
-
Just for hint, there are other ways:
select c_id from test where p_id = &input
union all
select c_id from test where p_id in ( select c_id from test where p_id = &input);
Take care
-
SQL-Connect
We can use LEVEL column for this Solution
See the Answer for this query so that u can understand easily
select c_node from dbaquery connect by prior c_node=p_no
start with p_no=&input;
ok bye
komethagan
from byzan Systems
[Edited by komes on 02-09-2001 at 09:09 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|