CLOSE DATABASES
USE 今日错题.dbf ALIAS lcdbfb
IF FSIZE("错误次数")=0
ALTER table lcdbfb ADD 错误次数 c(2)
ENDIF
select 单词,count(单词) as cnts from lcdbfb GROUP BY 单词 INTO CURSOR lsybb
SELECT MAX(cnts) FROM lsybb INTO CURSOR lscsb
lccs=MAX_cnts
*?lccs
SELECT lcdbfb
S=0
DO while S<lccs
FOR I=1 TO RECCOUNT()
GO I
IF DELETE()
LOOP
ELSE
OLDRECN=I
单词1=ALLTRIM(单词)
ENDIF
LOCATE REST FOR ALLTRIM(单词)==单词1
NJS=0
DO WHILE FOUND()
NJS=NJS+1
IF NJS>S
REPLACE 错误次数 WITH ALLTRIM(STR(NJS))
ENDIF
CONTINUE
ENDDO
I=OLDRECN
ENDFOR
S=S+1
ENDDO
CLOSE DATABASES
SELECT * FROM 今日错题.dbf INTO CURSOR lstj READWRITE
ALTER table lstj ADD id c(2)
REPLACE ALL id WITH ALLTRIM(STR(RECNO()))
DELETE FROM lstj WHERE lstj.id NOT IN ( SELECT m2.mid FROM ( SELECT 单词,max(id) AS mid FROM lstj GROUP BY 单词 ) AS m2)
PACK
ALTER TABLE lstj DROP COLUMN id
COPY TO cctj
USE cctj
BROWSE LAST
CLOSE ALL
QUIT
[此贴子已经被作者于2018-8-18 14:51编辑过]