A program error (by yours truly) caused several rows to be duplicated in a client's table.
I needed a script to delete the dupes so I searched and found this little jewel.
Other scripts involve temporary tables, etc but this simple script works like a charm.
My newbie question is .. I thought you had to specify all the group by elements in the query result.
Obviously you don't.
What am I missing?
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3)
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.