mysql delete duplicates query

by Prakash 2013-05-09 14:59:59

This query is to delete duplicates from a table called rating based on the two fields uid and kid. Before performing these kind of query backup your table.

delete t.* from rating t inner join (select * from rating t1 group by uid,kid having count(distinct id) > 1) t2 on t.uid= t2.uid and t.kid = t2.kid;

Tagged in:

486
like
0
dislike
0
mail
flag

You must LOGIN to add comments