Foxpro 替换为“”不在

Foxpro replace with "" not in

特此寻求解决办法。我每个 1 月和 2 月都有一个 dbf。每个dbf中有两个名为A和B的列,A是一系列数字,B是vlookup,如果它在columnA中的值没有出现在A列中,我想用"new"替换二月份的columnB一月,"old" 反之亦然。我的代码如下:

REPLACE ALL B WITH "Old"
REPLACE ALL B WITH "New" FOR A NOT IN (sele A FROM &filejanuary)

谢谢。

update February set February.B = 'Old'
update February set February.B = 'New' ;
   where not exists (select * from January where January.A = February.A)

上述评论员很接近。
使用 SQL 更新命令...

* --- Replace ALL Feb.B with "Old" ---
UPDATE February SET February.B = 'Old'

* --- Now change Feb.B to "New" for Applicable Conditions ---
UPDATE February SET February.B = 'New' ;
  WHERE February.A NOT IN (SELECT A FROM January)  

注意 - 还有一个 VFP 命令方法

* --- Replace ALL Feb.B with "Old" ---
SELECT February
REPLACE ALL February.B WITH "Old"

* --- Relate table January to table February through Field A ---
SELECT January
SET ORDER TO A   && Assumes Index built on Jan with Expression = A

SELECT February
SET RELATION TO A INTO January
* --- Replace ALL Feb.B with "New" for No Related A in Jan ---
REPLACE ALL B WITH "New" FOR EMPTY(January.A)

祝你好运

此外,如果您想使用 xBase,那么 January.A 上有一个索引会简单得多(假设它的标签是 JanA - 谁会真正命名字段 A,B.. .) :

select February
replace all B with iif( seek(February.A, 'January', 'JanA'), 'Old', 'New')