Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Remove trash from xlink table
Message
From
24/07/2007 04:13:13
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Remove trash from xlink table
Miscellaneous
Thread ID:
01243096
Message ID:
01243096
Views:
58
Hello.
I have a cross-link table for many-to-many named M2m.
After testing I'd like to remove trash records from it. M2m links records in Dok1 table. Here are two deletes:
1.
delete M2m from M2m Left Join Dok1 T1 on T1.Pk=M2m.Pk1 ;
   Left Join Dok1 T2 on T2.Pk=M2m.Pk2 ;
   Where isnull(T1.Pk) and isnull(T2.Pk)

2.
delete from M2m where not exists (select Pk from ;
   Dok1 where Pk=M2m.Pk1) and not exists (Select PK ;
   from Dok1 where Pk=M2m.Pk2)
Which one of them is better or maybe you suggest your version.
I also have a question about statement Nr2.
How do subqueries behaive in such cercumstances? Do they behaive like completely seperate Selects? In my example would the subquery: (Select Pk from Dok1 where Pk=M2m.Pk1) consider M2m for the Delete and M2m for itself as two different tables? So that for every subquery Recno('M2m') will show the same number.

Kamil
A moment of silence is our cosmic reset button.
Next
Reply
Map
View

Click here to load this message in the networking platform