缺少循环语句,所以只能替换第一条记录
VFP9代码
UPDATE TY SET FS1=FS FROM PFK WHERE BETWEEN(CJ1,T1A,T1B) AND XB=PFK.XB
UPDATE TY SET FS2=FS FROM PFK WHERE BETWEEN(CJ2,T2A,T2B) AND XB=PFK.XB
UPDATE TY SET FS3=FS FROM PFK WHERE BETWEEN(CJ3,T3A,T3B) AND XB=PFK.XB
**********************
VFP6代码
USE PFK
SCAN
UPDATE TY SET FS1=FS WHERE BETWEEN(CJ1,T1A,T1B) AND XB=PFK.XB
UPDATE TY SET FS2=FS WHERE BETWEEN(CJ2,T2A,T2B) AND XB=PFK.XB
UPDATE TY SET FS3=FS WHERE BETWEEN(CJ3,T3A,T3B) AND XB=PFK.XB
ENDSCAN
或者
USE PFK IN 0
USE TY IN 0
SELECT PFK
SCAN
SELECT TY
LOCATE FOR BETWEEN(CJ1,T1A,T1B) AND XB=PFK.XB
IF FOUND()
REPLACE ALL FS1 WITH PFK.FS
ENDIF
LOCATE FOR BETWEEN(CJ2,T2A,T2B) AND XB=PFK.XB
IF FOUND()
REPLACE ALL FS2 WITH PFK.FS
ENDIF
LOCATE FOR BETWEEN(CJ3,T3A,T3B) AND XB=PFK.XB
IF FOUND()
REPLACE ALL FS3 WITH PFK.FS
ENDIF
ENDSCAN