Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN and query result
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00537855
Message ID:
00539427
Views:
23
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform