Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Help
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00638949
Message ID:
00639011
Vues:
22
What does it mean to be a 'correlated query'.

Brenda


>
>
* In table1
SELECT * FROM table2 ;
WHERE custn1+custn2 IN ( SELECT custn1+custn2 FROM table1)
* the same with correlated query (could be slower or faster than previous)
SELECT * FROM table2 t2 ;
WHERE EXISTS ( SELECT * FROM table1 t1 ;
WHERE t1.custn1+ t1.custn2 = t2.custn1+ t2.custn2)
* or if you've separate indexes on custn1 and custn2
SELECT * FROM table2 t2 ;
WHERE EXISTS ( SELECT * FROM table1 t1 ;
WHERE t1.custn1 = t2.custn1 And t1.custn2 = t2.custn2)

* Not in table1
SELECT * FROM table2 ;
WHERE custn1+custn2 NOT IN ( SELECT custn1+custn2 FROM table1)
* for correlated queries just change EXISTS to NOT EXISTS
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform