程序代码:
CLOSE DATABASES
SET SAFETY OFF
t1=SECONDS()
USE 比较后
ZAP
SELECT * FROM 原表 INTO CURSOR tt
SELECT 原表
LOCAL aaa[1,11]
SCAN
SCATTER TO aa
=ACOPY(aa,aaa)
aaa[1,11]="以第"+TRANSFORM(RECNO())+"条记录为准"
INSERT INTO 比较后 FROM ARRAY aaa
=bj(ALEN(aa),@aa)
ENDSCAN
MESSAGEBOX("共用时:"+TRANSFORM(SECONDS()-t1)+" 秒")
SELECT 比较后
n=0
* 统计记录数
FOR i=RECCOUNT() TO 1 STEP -1
GO i
IF NOT "以"$循环记录
n=n+1
ELSE
REPLACE RECORD i 循环记录 WITH 循环记录-",有"-TRANSFORM(n+1)-"条记录"
n=0
ENDIF
ENDFOR
BROWSE &&FOR LEFT(循环记录,2)=="以" AND "有10条"$循环记录
* 自定义函数
FUNCTION bj(n,arr)
cStr=""
FOR ii=1 TO n
cStr=cStr+IIF(EMPTY(cStr),""," ")+PADL(arr[ii],3,"0")
ENDFOR
SELECT tt
LOCAL bbb[1,11]
SCAN
oK=.F.
SCATTER TO bb
FOR ii=1 TO n
IF AT(PADL(bb[ii],3,"0"),cStr)>0
oK=.T.
EXIT
ENDIF
ENDFOR
IF ok=.F.
=ACOPY(bb,bbb)
bbb[1,11]="第 "+TRANSFORM(RECNO("tt"))+" 条"
INSERT INTO 比较后 FROM ARRAY bbb
* 不相同的数据保存在字符串中
FOR ii=1 TO n
cStr=cStr+IIF(EMPTY(cStr),""," ")+PADL(bb[ii],3,"0")
ENDFOR
ENDIF
ENDSCAN
ENDFUNC
[此贴子已经被作者于2018-7-23 19:17编辑过]