I agree, INDEXSEEK() will be more efficient in this case.
>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.
--sb--