>>>>select KeyID, <b>recno() as RecNum</b>, count(*) as CntDups from yourtable group by KeyID ; >>>> having CntDups > 1 ; >>>> into cursor curDupes >>>>index on KeyID tag KeyID >>>>select yourtable >>>>set relation to KeyID into curDupes >>>>delete for found('curDupes') and recno()=curDupes.RecNum && One of the dupes would be deleted>>>
select KeyID, count(*) as CntDups from yourtable group by KeyID ; having CntDups > 1 ; into cursor curDupes if _tally>0 && There are dups in table index on KeyID tag KeyID scan if seek(KeyID,'YourTable',"KeyID") && should be always found * select YourTable delete in YourTable && One duplicated record is deleted now endif endscan endif use in curDupes