Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remove trash from xlink table
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Remove trash from xlink table
Divers
Thread ID:
01243096
Message ID:
01243096
Vues:
60
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform