Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Questions
Message
De
23/09/2005 19:00:30
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01052562
Message ID:
01052613
Vues:
7
So...are JOINS generally faster than using the subset version?

I was just going to ask if the following would be better implemented with JOINS.
SELECT * FROM crsMatchResults ;
INTO CURSOR crsMatchResults ;
WHERE ;
(Sequence in (SELECT Sequence FROM crsSurvivors) OR ;
 Sequence in (SELECT Sequence FROM crsDuplicates)) AND ;
(GroupNum in (SELECT GroupNum FROM crsSurvivors) AND ;
 GroupNum in (SELECT GroupNum FROM crsDuplicates)) ;
ORDER BY Sequence ;
READWRITE NOFILTER 
Aloha,

James

>It's unknown how VFP handles such conditions but most likely it creates a cursor with subquery and then matches each record from the main table to it. The following command should be faster
UPDATE Invoices ;
>		SET InvoiceId = "ABC123" ;
>	FROM Invoices
>		JOIN Invoices2 ON Invoices2.RecordId = Invoices.RecordId
>
>
>>I have the following command:
>>
>>
>>UPDATE Invoices;
>>  SET InvoiceId = "ABC123";
>>  WHERE RecordId IN;
>>    (SELECT RecordId
>>     FROM Invoices2)
>>
>>
>>
>>
>>
>>1) Does VFP first create a subset of Invoices2.RecordId and then use that
>>to drive the update Invoices? Or is each record in Invoices2 evaulated
>>for every record in Invoices?
>>
>>2) Is there a more efficient way to do this?
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform