Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Parent-Child-Grandchild...
Message
De
28/02/2001 14:26:37
 
 
À
28/02/2001 14:18:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00480544
Message ID:
00480661
Vues:
8
Oh! So assuming your iID is in variable m.iID:

>This is an excellent start, but it stops just short of what I need.
>
>Query 1 returns the descendents of EVERY parent. I need it to return only the descendents of parent with a given iID.
SELECT * FROM tblFamily ;
    WHERE iParentID == m.iID
>Query 2 returns the parent of EVERY child. I need it to return just the ancestors of a child with a given iID.
SELECT tblChild.iID AS C_iID, ;
    tblChild.iParentID AS C_iParentID, ;
    tblChild.cInfoAndStuff AS C_cInfoAndStuff, ;
    tblParent.cInfoAndStuff AS P_cInfoAndStuff ;
    FROM tblFamily tblChild ;
        INNER JOIN tblFamily tblParent ;
            ON tblChild.iParentID == tblParent.iID ;
    <b>WHERE tblChild.iID == m.iID</b>
>Thanks again for your help.

Glad I can be of assistance!
Sylvain Demers
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform