>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 :-)
>
You can create an index on an expression; for example, you could concatenate two character fields together to create an index based on both. For example, if you have a table with two character fields, you could build an index from the concatenation using the + operator. For example, with two fields lastname, 15 characters long, and firstname, 10 characters long, you could create an index based on lastname+firstname. When this index is used, you could use SEEK to find John Smith by:
SEEK PADR('Smith',15)+'John'
You need the PADR() so that the last name will be as long as the lastname field letting the first name start in the proper column of the expression getting examined.
Fields of differing types generally would need to be converted to strings for concatenating them under a single index.