FAQ
Read the SQL documentation on the SELECT statement -- the CONNECT BY ...
PRIOR clause.

Hemant
At 10:23 PM Friday, Sandeep Dubey wrote:
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
Hemant K Chitale
http://web.singnet.com.sg/~hkchital

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
grouporacle-l @
categoriesoracle
postedAug 26, '05 at 9:25a
activeAug 26, '05 at 9:59a
posts3
users3
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase