>Hi,
>
>I'm trying to make a searchform where Ithe user can serach for a customer on muliple fields at the same time (fields are phonenumber, name, adresse, zipcode...)
>
>If I make a select statement with all these fields in it - the query takes up to 30 seconds og at table with 350000 records. How can I optimize this searchtime ?
>
>
>Regards,
>
>Kenneth Ingebrigtsen
Kenneth,
Your search fields sound to be no more than a few where one of the records wouldn't no longer than one K. You might copy them to an SDF file and search on line numbers. ie:
select myTable
copy fields phonenumber, name, adresse, zipcode to mydata.txt type sdf
StrToFile(upper(FileToStr('mydata.txt'),'myData.txt')
*Search routine
lparameters tcSearch
set memowidth to 1024
lcSearch = FileToStr('myData.txt')
create cursor ExistIn (irec i)
nOccurs = occurs(upper(tcSearch),lcSearch)
for ix = 1 to nOccurs
insert into ExistIn values (atline(tcSearch,lcSearch))
endfor
select * from myTable ;
where recno() in ;
(select irec from ExistIn) ;
into cursor crsResult
Cetin