回复 7楼 吹水佬
非常感谢吹水佬老师的帮助。运行很好,与手动统计结果一致。
统计结果如能以表的形式存在,有利于后续再统计。
请老师再帮助一下,将结果以表的形式显示。
USE k1 IN 0 ALIAS a USE k1 IN 0 ALIAS b AGAIN SELECT 0000 记录号,n1 FROM a WHERE .f. INTO CURSOR tmp READWRITE SELECT a SET RELATION TO RECNO()+1 INTO "b" SCAN IF a.n1==91 INSERT INTO tmp VALUES (RECNO("a"),a.n1) INSERT INTO tmp VALUES (RECNO("b"),b.n1) ENDIF ENDSCAN SELECT * FROM tmp
SELECT 0000 记录号,n1 FROM k1 WHERE .f. INTO CURSOR tmp READWRITE SELECT k1 DO WHILE !EOF() IF n1==91 INSERT INTO tmp VALUES (RECNO("k1"),k1.n1) SKIP IF !EOF() INSERT INTO tmp VALUES (RECNO("k1"),k1.n1) ENDIF ENDIF IF !EOF() SKIP ENDIF ENDDO SELECT * FROM tmp
b1 = .f. SELECT *, RECNO() 记录号 FROM k1 WHERE fun() FUNCTION fun() IF n1==91 b1 = .t. RETURN .t. ENDIF IF b1 b1 = .f. RETURN .t. ENDIF RETURN .f. ENDFUNC
SELECT RECNO() 记录号,* FROM k1 INTO CURSOR tmp SELECT a.记录号,a.n1,b.记录号,b.n1 FROM tmp a JOIN tmp b ON a.n1==91 AND a.记录号==b.记录号-1