Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding orphan records
Message
From
23/01/2009 09:49:43
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
23/01/2009 09:41:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01376524
Message ID:
01376536
Views:
13
>>If I have a table that could be tied to a couple other tables, which could have dependents themselves, how could I find records that have no parent/grandparents?
>
>I think you will have to do a subquery for every table that might contain child records, e.g.:
>
>
>select * from ChildTable;
>  where ParentKeyField not in (select ParentKeyField from ParentTable)
>
>
>You should avoid this situation in the first place, by using Referential Integrity. After correcting the orphan records, I would strongly suggest you implement RI.

I agree, but this is not production data. It is our test dataset that has had many things happen to it over the years with good/bad tested code gong on. I'm just trying to get it straight a bit so we cut down on the odd behaviors we get from the data so we can concentrate on the odd behaviors we get from our code. Our data uses RF now and is pretty solid, but historically...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform