DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Query

  1. #1
    Join Date
    Jan 2001
    Posts
    50
    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

  2. #2
    Join Date
    Oct 2000
    Posts
    123
    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


  3. #3
    Join Date
    Feb 2001
    Posts
    9

    Cool 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
  •  


Click Here to Expand Forum to Full Width