Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> SQL query

SQL query

From: Sandeep Dubey <dubey.sandeep_at_gmail.com>
Date: Fri, 26 Aug 2005 10:23:39 -0400
Message-ID: <bf2f74740508260723ec33446@mail.gmail.com>


Hi,

Can someone help me with the sql query. It is similar to emp_id and manager_id.

create table account_test(id number, parent_id number);

insert into account_test values(1,null);
insert into account_test values(100,1);
insert into account_test values(101,1);
insert into account_test values(102,1);
insert into account_test values(200,100);
insert into account_test values(201,100);
insert into account_test values(300,200);

Here id 1 is parent of 100, 101 and 102
100 is parent of 200 and 201
300 is child of 200

I need to write a query that id 1 can see all records. 100 can see it's and all its child and sub-child i.e. 100, 200, 201 and 300 200 can get 200 and 300.
It will be N-tier parent-child.

Thanks

Sandeep

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Aug 26 2005 - 09:25:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US