Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
0 or More Children recs. but need SQL for NULL or first
Message
De
19/03/2007 03:51:12
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01205365
Message ID:
01205383
Vues:
9
>Hi all
>
>I have parent-child tables. The child table can have 0 or more records for each parent record.
>
>I need to write an SQL where in each row I get a parent record and an either a NULL fields for the child table or only these 1st child record (no multiple occurrence of the parent record due to multiple child recs.), for each and every parent record.
>
>Please let me know how I can go about this.
SELECT *
 , (select top 1 field from child WHERE fk_Parent=Parent.pk order by fk_Parent) as child_field 
   FROM Parent
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform