Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete parent if no child exist?
Message
From
21/01/2000 15:03:16
 
 
To
21/01/2000 10:56:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00320916
Message ID:
00321097
Views:
19
>>>>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
>>
>>Thank you very much!!! That was a very quick response!!!
>
>
Mine is quick ? Your reply came back before my "view" refreshed. I thought you replied before even I pressed "send" :) That's the fastest reply I've ever got :-)
>Cetin

See my other reply. When I try the DELETE FROM that you suggested I get an error message that the use of union in a subquery is not supported.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform