Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Child with no parent
Message
 
 
To
14/08/2001 08:05:11
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00543419
Message ID:
00543433
Views:
17
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform