* sele tabela A * set order to indice sele tabela B * go top scan && SCAN has implicit GO TOP * sele tabela A * seek(tabela B.campo) * if found() IF seek(tabela B.campo, tabela A, indice) && SEEK() function *[sb] < 1 > *[sb] < 2 > replace value from tabelaB to tabelaA *[sb] < /2 > * sele tabela B *[sb] < /1 > *[sb] < 3/ > endif endscan && ENDSCAN always does implicit table selectIf
indece
is not unique, you may have an additional optimization by adding a SCAN WHILE where I've placed the < 1 >
tag, especially if indece
has large clusters of distinct values.tabela B.campo
is not unique and is the active index, you may benefit from an empty SCAN WHILE
to the next distinct value at tag < 3 >
. Similarly if tabela B.campo
is not unique, consider running the outer SCAN
off a SELECT DISTINCT ... FROM Tabela B
cursor if you've got great clusters of tabela B.campo
values.IF ... <> ...
test at tag < 2 >
UPDATE SQL
might be faster, but smart procedural code is often as fast or faster in VFP.tabela A
physically sorted on the sought key, and this will probably be most helpful if you use UPDATE SQL.SELECT DISTINCT Foo FROM tabela A WHERE NOT IN (SELECT Foo FROM tabela B)
and making the resultant cursor the object of the outer SCAN