Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How i can do a recursive sql query
Try This:
SQL> desc famely
Name Null? Type ------------------------------- -------- ---- FATHER VARCHAR2(20) SON VARCHAR2(20)
SQL> select * from famely
2 /
FATHER SON
-------------------- -------------------- John Luc Luc Erik Erik Ron Ron Guy Ben Roger
SQL> select father, son from famely
2 connect by father = prior son
3 start with father = 'John'
4 /
FATHER SON
-------------------- -------------------- John Luc Luc Erik Erik Ron Ron Guy
SQL> select father, son from famely
2 connect by father = prior son
3 start with father = 'Ben'
4 /
FATHER SON
-------------------- -------------------- Ben Roger
HTH
Prasad Chavali
pchavali_at_assettech.com
Ronald Berube wrote in message <35a6698d.0_at_news.total.net>...
>I would like to know how i can do a recurvie sql.
>I have a table who contain the history (descendance) of famely (father,
son)
>table description father char(20)
> sun char(20)
>in that table we have all the generation of a famely.
>Ex : Select * from table.
>Father Son
>John Luc 1e generation
>Luc Erik 2e generation
>Erik Ron 3e generation
>Ron Guy 4e generation
>Ben Roger 1e generation
>What i would like to do is to extract with one sql all the associate
record,
>in same famely (ectract all record from John to Guy (4 record), if i give
>John for father, or only Ben if i gave Ben for father).
>Remenver i do not know the number of generation i will have in the table.
>
>Thank's for anay suggestion.
>
>Ronald
>berube.ronald_at_tourisme.gouv.qc.ca
>
>
>
>
Received on Fri Jul 10 1998 - 15:24:00 CDT
![]() |
![]() |