Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Child with no parent
Message
 
 
À
14/08/2001 08:05:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00543419
Message ID:
00543433
Vues:
12
This message has been marked as the solution to the initial question of the thread.
Eaither one'll retrieve the list of Child records w/o parent. I don't know wich one is faster.
SELECT * From ChildTable WHERE ChildTable.FK NOT IN ( ;
      SELECT ParentTable.PK from ParentTable)
   or
SELECT * From ChildTable WHERE NOT EXISTS ( ;
      SELECT ParentTable.PK from ParentTable ;
          WHERE ParentTable.PK = ChildTable.FK )
   or
SELECT ChildTable.* From ChildTable ;
    RIGHT OUTER JOIN ParentTable ON ChildTable.FK = ParentTable.PK ;
         AND ISNULL(ParentTable.PK)
The quickest
SELE * From ChildTable WHER FK NOT IN ( ;
      SELE PK from ParentTable)
>Hi
>
>What is the quickest statement to write to find out if a Child Table has records that have no Parent records?
>
>Thanks
>Kev
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform