CREATE CURSOR kmb (kmdm C(2), km C(4)) INSERT INTO kmb VALUES ("01","YWCJ") INSERT INTO kmb VALUES ("02","SXCJ") INSERT INTO kmb VALUES ("04","WLCJ") INSERT INTO kmb VALUES ("05","HXCJ") INSERT INTO kmb VALUES ("06","SWCJ") INSERT INTO kmb VALUES ("07","ZZCJ") INSERT INTO kmb VALUES ("08","LSCJ") INSERT INTO kmb VALUES ("09","DLCJ") INSERT INTO kmb VALUES ("31","WYCJ") INDEX on kmdm TAG kmdm USE a ALIAS ab IN 0 USE b ALIAS bb IN 0 SELECT bb INDEX on ksh TAG ksh SELECT ab SET RELATION TO ksh INTO "bb", kmdm INTO "kmb" REPLACE ALL cj WITH IIF(!EMPTY(ksh),EVALUATE("bb."+kmb.km),0) SELECT * FROM ab
[此贴子已经被作者于2021-3-9 15:57编辑过]
CLOSE DATABASES SELECT 0 USE b ALIAS kg SELECT 0 USE a ALIAS bmk SELECT kg SCAN cksh=kg.ksh FOR i=3 TO FCOUNT() zdmc=FIELD(i) zdm='KG.'+ZDMC DO case CASE zdmc='YWCJ' ckmdm='01' CASE zdmc='SXCJ' ckmdm='02' CASE zdmc='WLCJ' ckmdm='04' CASE zdmc='SWCJ' ckmdm='06' CASE zdmc='ZZCJ' ckmdm='07' CASE zdmc='LSCJ' ckmdm='08' CASE zdmc='DLCJ' ckmdm='09' CASE zdmc='WYCJ' ckmdm='31' CASE zdmc='HXCJ' ckmdm='05' ENDCASE &&& 将字段名转换为学科代码,以用于查找 SELECT bmk LOCATE FOR bmk.ksh=cksh AND bmk.kmdm=ckmdm IF FOUND() REPLACE bmk.cj WITH EVALUATE(zdm) ENDIF SELECT kg ENDFOR ENDSCAN