>>SELECT Accountno As Account_No,COUNT( * ) AS DupCount; >> FROM New_master ; >> INTO CURSOR Duplicates ; >> GROUP BY Accountno ; >> HAVING DupCount > 1 >>>>
>delete NM from New_Master NM ; >where exists (select 1 from (SELECT Accountno As Account_No,COUNT( * ) AS DupCount, MAX(AccountDate) as LastDate ; > FROM New_master ; > GROUP BY Accountno ; > HAVING DupCount > 1) X where X.Account_No = NM.AccountNo and NM.AccountDate < X.LastDate)---
SELECT Accountno As Account_No,COUNT( * ) AS DupCount; FROM New_Master ; INTO CURSOR Duplicates ; GROUP BY Accountno ; HAVING DupCount > 1 IF Dupcount>1 SELECT Duplicates SCAN FOR I=1 TO (DUPCOUNT-1) DupAccount_no=Account_no SELECT New_master LOCATE FOR Accountno=DupAccount_no DELETE SELECT Duplicates ENDFOR SELECT New_master ENDSCAN USE IN Duplicates ENDIF