Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Parent-Child-Grandchild...
Message
From
28/02/2001 14:26:37
 
 
To
28/02/2001 14:18:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00480544
Message ID:
00480661
Views:
9
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
Previous
Reply
Map
View

Click here to load this message in the networking platform