Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> query to trace all parents
Hi,
I have a table with filled out below data:
+------+-----+
|parent|child|
+------+-----+
|A |B |
|B |C |
|B |E |
|C |D |
|E |F |
|E |G |
+------+-----+
So I have to make a query which get all 'parent' values values for given child value.
For example :
If I have to get all parent values for 'F' child., query must get this values : E, B, A.
If I have to get all parent values for 'C' child., query must get this values : B, A.
If I have to get all parent values for 'B' child., query must get this values : A only.
Is it possible to create a query which will covers all above conditions or not using only sql statement without UDF or stored procedures.
Any solutiuons?
Sincerely,
Rustam Bogubaev
Received on Thu Jun 23 2005 - 12:30:38 CDT
![]() |
![]() |