Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indexed searches...
Message
 
 
To
18/07/2000 08:13:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00393714
Message ID:
00393810
Views:
17
>Hi.
>
>I wonder if it's there any way to make searches on two field of the same table at the same time using indexes. I'm using the LOCATE command to search for the two fields wich must be iqual to certain variables. but it's gettin' to slow and the table it's not so big
>big already!!!
>The SEEK command it's eable to search just on one field at the time...or not...
>
>NOTE: I wonder if 'indexes' and 'searches' words are well written although :-)
>
>Thanks

While Nigel and Ed told you how to do this using compound indexes, you can do this in two steps if the indexing scheme is not viable.

You can use a combination of SEEK and LOCATE ... FOR ... WHILE.
set index to firstindex
seek firstvalue
locate for secondfield = secondvalue while firstfield = firstvalue

This limits the scope of the LOCATE command and depending on the number of records matching the firstvalue can be extremely fast (even for large tables).
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform