Wednesday, November 10, 2010

SQL for delete duplicates

delete from table where id in (select (select id from table where col82 = x.col82 order by id asc limit 1) from (select count(id) cnt, col82 from table group by col82 order by cnt desc) x where x.cnt > 1);

No comments:

Post a Comment