回复 10楼 yd1954
看看我发在4楼的代码,应该已经给你解决了.符合条件的是418条记录吧.
CLOSE DATABASES ALL USE 表9 ALIAS b9 IN 0 USE 表10 ALIAS b10 IN 0 SELECT b10 ZAP SELECT z59, z60, z61, z62, z63, z64, z65, z66, z67, z68, z69 FROM 表8 WHERE RECNO() = RECCOUNT() INTO ARRAY a8 SELECT b9 SCAN SCATTER FIELDS z59, z60, z61, z62, z63, z64, z65, z66, z67, z68, z69 TO a9 LOCAL a10[1, 14] a10 = 0 a10[1, 1] = h1 a10[1, 2] = h2 a10[1, 3] = h3 ok = 0 FOR i = 1 TO 11 IF ASCAN(a9, a8[i]) > 0 ok = 1 EXIT ENDIF ENDFOR IF ok = 1 LOOP ENDIF FOR i = 1 TO 11 IF a9[i] != a8[i] a10[1, i + 3] = a9[i] ENDIF ENDFOR INSERT INTO 表10 FROM ARRAY a10 ENDSCAN SELECT b10 BROWSE
CLOSE DATABASES USE 表8 ALIAS B8 IN 0 USE 表9 ALIAS B9 IN 0 USE 表10 ALIAS B10 IN 0 *!* 查找动态比对参数 SELECT t0.Qihao,z59,z60,z61,z62,z63,z64,z65,z66,z67,z68,z69 FROM B8 AS t0 ; RIGHT JOIN (SELECT NVL(MAX(Qihao),0) as Qihao FROM B8) AS t1 ON t0.Qihao=t1.Qihao ; INTO ARRAY a8 *!* 拼接动态比对条件 LOCAL s1,ii s1=TRANSFORM(a8[1,2]) FOR ii=3 TO 12 s1 = s1 + "," + TRANSFORM(a8[1,ii]) ENDFOR *!* 查询过滤新数据 SELECT H1,H2,H3,z59,z60,z61,z62,z63,z64,z65,z66,z67,z68,z69 FROM b9 WHERE ; !INLIST(z59,&s1) AND ; !INLIST(z60,&s1) AND ; !INLIST(z61,&s1) AND ; !INLIST(z62,&s1) AND ; !INLIST(z63,&s1) AND ; !INLIST(z64,&s1) AND ; !INLIST(z65,&s1) AND ; !INLIST(z66,&s1) AND ; !INLIST(z67,&s1) AND ; !INLIST(z68,&s1) AND ; !INLIST(z69,&s1) INTO ARRAY a9 *!* 生成新的表10数据 SELECT b10 ZAP APPEND FROM ARRAY a9 BROWSE