Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete parent if no child exist?
Message
From
21/01/2000 13:04:21
 
 
To
21/01/2000 10:51:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00320916
Message ID:
00321016
Views:
18
>>What is the best way to loop though a table and delete parent records if no child records exist?
>>
>>Thanks for any tips!!!
>>
>>Joe
>
>
Delete for !seek(PK,"ChildTable1","ChildFKTag") ;
> and !seek(PK,"ChildTable2","ChildFKTag") ;
> ....
>
>*or
>delete from parent ;
> where pk not in ;
> (select distinct ChildFK from child1 ;
>    union select distinct ChildFK from child2)
Cetin

*or

delete from parent ;
where pk not in ;
(select ChildFK from child1) and ;
pk not in (select ChildFK from child2)
Previous
Reply
Map
View

Click here to load this message in the networking platform