Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Join Parent with 2 child Tables
Message
 
À
03/09/2012 09:45:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01552239
Message ID:
01552319
Vues:
39
Hi Tamar.
Yes, that sounds like exactly what I need.. thanks
regards,
Gerard


>>Hi.
>>Is there a way , with one select statement, to join a Parent with two Child Tables, without doing an outer join (I dont want to end up with Nulls)
>>
>>So I want an inner join as in (Select * from Master join (Child1 / Child2) on MasterKey = ChildKey
>>Both Child Tables have identical structure.
>>Say I have a Parent Country Table, (Ctry c(10) ) with two child tables for each year 2011, 2012 (childFK c(10), Salesqty n(12) )
>>
>>I want to select Out from Parent Table and (Chi2011 / Chi2012) and end up with a Table where there is a match between the parent and EITHER of the children. So I want to end up with all the fields from the parent and all the fields from Child (Child2011 or Child2012)
>>
>
>Would a UNION give you what you want?
>
>
>SELECT whatever ;
>  FROM Parent ;
>    JOIN Child1 ;
>       ON Join Conditions ;
>UNION ;
>SELECT whatever ;
>  FROM Parent ;
>    JOIN Child2 ;
>       ON Join Conditions 
>
>
>Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform