Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: recursive sql statement
Just a thought ( I can't test to see if this works or not I am in the
middle of reinstalling linux)
select a.child, b.parent
from grp a, grp b
where a.child > b.parent;
Scott
Larry Pettit <larry.pettit_at_ps.net> wrote in message
news:UkgW3.175$ed7.14166_at_news.uswest.net...
> I currently have a table as follows;
>
> grp(
> parent number(5),
> child number(5))
>
> data sample for grp
>
> parent child
>
> 100 200
> 200 400
> 400 600
> 600 700
>
> child 700 has parent layers of 600, 400, 200, 100
> child 400 has parent layers of 200, 100
>
>
> In other words a child could be a parent to another child. A child could
> have many layers of parents. I could do a correlated subquery for each
> level that I know about , but is there a way to create a simple recursive
> sql statement that will return all preceding layers of parents for a child
> at any level .
>
> Thanks
>
>
Received on Wed Nov 10 1999 - 20:24:33 CST