Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SCAN and query result
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00537855
Message ID:
00539427
Vues:
15
Sergey,

A variation on the theme (at least I think I see a theme developing in this thread):
SELECT DISTINCT KeyField ;
  FROM AnotherTable ;
  INTO CURSOR KeyCursor

INDEX ON KeyField TAG KeyField

SELECT MyTable
SCAN FOR INDEXSEEK(MyTable.KeyField, .F., "KeyCursor", "KeyField")
  ... do stuff
ENDSCAN

USE IN KeyCursor
Advantages:
Not relying on a SET RELATION.
Faster... when your doing an INDEXSEEK("", .F.) the record pointer in KeyCursor doesn't move. You're just traversing the CDX.


One thing you absolutely do not want to do is add a UDF to a SQL query. VFP will run the UDF with every row of the source cursor, which KILLS performance.

Regards,
Thom C.

>>In this case just reverse reletationship

SELECT KeyField from AnotherTable Into Cursor KeyCursor
INDEX ON KeyField TAG KeyField
SELECT Mytable
SET RELATION TO KeyField INTO KeyCursor
SCAN FOR FOUND("KeyCursor")
...
ENDSCAN
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform