>Hi. I have a database with a lot of duplicates (but it is ok). How can I mark/delete all but the last instance of each entry? Please keep in mind that I am in v.7.
>
>Thanks, Randy
Try
select max(ID) as IDToKeep, GroupID from myTable GROUP BY GroupID having count(*) > 1 into cursor Dups
delete from myTable where exists (select 1 from Dups where myTable.GroupID = Dups.GroupID and myTable.ID < Dups.IDToKeep)
If it's not broken, fix it until it is.
My Blog