Hilmar,
Check my FAQ "Best way to find orhpans". You can use either:
scan for indexseek(KeyField,.f.,'Table2','KeyIndex')
endscan
of using KeyMatch, which would be faster.
Another way would be to set relation and
scan for found()
endscan
>I want to process, in a SCAN loop, all records that satisfy a given condition. The condition is most easily expressed as a SELECT - SQL - but what is the best way to combine the two?
>
>
>Pseudocode:
>
>SCAN where KeyField in (SELECT KeyField from AnotherTable)
> ...
>ENDSCAN
>
>
>The processing itself is too complicated to place into a single INSERT - SQL command.
>
>Basic criteria: 1) code should not be too messy, 2) it should be reasonably fast.
>
>TIA, Hilmar.
If it's not broken, fix it until it is.
My Blog