Page 1 of 1

removing duplicates

Posted: Wed 01 Feb 2006 10:24
by alchemy9
Assuming I has duplicates in a column COl1in a table called dupe

Col1
-----
123
123
123
456

once I have identified the duplicates using the following quiery

select
distinct col1
from dupe
group by Col1
having count(Col1) >1

is there a way I could delete duplicates without putting a unique column on the table?

i was thinking of using

MSQuery1.delete; and going through the records of identified duplicates, or is there a way of using recNo


thanks in advance

Ian

Posted: Mon 06 Feb 2006 10:23
by Ikar
Try using SELECT statement with DISTINCT keyword. But it isn't the best way. May be better for you is to add to the table one more field with AUTO_INCREMENT attribute and to make it a key field. Please read MySQL Server manual for more information.