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

Home -> Community -> Usenet -> comp.databases.theory -> query to trace all parents

query to trace all parents

From: PYCTAM <rbogubaev_at_bookinturkey.com>
Date: 23 Jun 2005 10:31:21 -0700
Message-ID: <1119547881.653907.275480@z14g2000cwz.googlegroups.com>


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 'D' child., query must get this values : C, B, A.

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:31:21 CDT

Original text of this message

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