...

View Full Version : Deleting duplicated keys from mysql, how?



kaisellgren
03-19-2007, 06:09 PM
Hi,

I have a mysql table which has duplicated content. I want to delete all duplicated content, except leave one row. any suggestions?

guelphdad
03-19-2007, 08:12 PM
for a mysql question post in the mysql forum I'd suggest.

But yes you can do this:



ALTER IGNORE TABLE
tablename
ADD droplater UNIQUE(column1, column3, column4)


and later drop the index or leave it in as necessary.

you have to include all the columns that you want unique, and that is unique across those columns. for instance I left out column2 so you could have two rows with same info in columns 1,2,3 or 1,2,4 but not 1,3,4



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum