其實這種排查重複數據的手法,全都是一樣的原理,類似的代碼示例我也發過多次,但總就見個別長期反復問同一類的問題,根本學不到手的。
授人以渔,不授人以鱼。
Set Collate To "MACHINE" create cursor test (dwmc C(10),xm C(6),zm C(100),sfzh C(18)) insert into test values ("A","01","","123") insert into test values ("B","02","","456") insert into test values ("C","03","","789") insert into test values ("B","04","","459") insert into test values ("C","05","","567") insert into test values ("D","06","","213") insert into test values ("E","07","","124") insert into test values ("A","08","","218") insert into test values ("C","03","","567") insert into test values ("A","01","","123") Index on dwmc+xm tag xm go top scatter memv fields dwmc,xm scan for recno()>1 lncnt=recno() if dwmc==m.dwmc and xm==m.xm replace zm with alltrim(xm)+space(4)+alltrim(sfzh) skip -1 replace zm with alltrim(xm)+space(4)+alltrim(sfzh) skip endif scatter memv fields dwmc,xm endscan browse close database all