Abhishek
First of all make sure both tables are indexed on the PostCode, and that this index is current, i.e. they're ordered by it.
Now I'm not sure you have this the right way round. Normally one goes through rec's in one table and looks up the detail, given by a key, in a look-up table. e.g. an entity record has a county key, pointing to the County table, to look up the county's details.
It's usual for look-up tables to have fewer recs than the main, e.g. thousands of customer recs will have the same county key.
Anyway, in your described scenario, something like:
Select LOOKUP
Scan
lcPostCode = LOOKUP.POSTCODE
If INDEXSEEK( lcpostCode, .F., "S1", "POSTCODE")
INDEXSEEK( lcpostCode, .T., "S1", "POSTCODE")
Select S1
Scan while S1.POSTCODE = lcPostCode
EndScan
EndIf
EndScan
HTH
Terry
>hi everybody,
>
>I have to make a program where i have to search data into a table using a lookup table. The situation is like this
>
>lookup table : 10000 records where there is field like postcode,address,name
>searched table(S1) : 1.5 million records contains postcode, address, name etc
>
>now using postcode from lookup table, i have to search it in S1. If found i have to compare address and if matched, i have to match the name. Once complete match is done, i have to pull that record out (which is easy. i hope!!).
>If anybody can suggest me an approach which is fastest and effective, i would be very grateful.
>
>Many, many thanks in advance
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.