Just an example - this query returns duplicate messages, now you just need to execute delete
id| title | text_desc | created ------------------------------------------------------- 1 | The title | description here |2012-02-21 10:58:58 2 | The title | description here 1 |2012-02-21 10:58:58 3 | The title | description here 3 |2012-02-21 10:58:58 select bad_rows.* from posts as bad_rows inner join ( select title, MIN(id) as min_id from posts group by title having count(*) > 1 ) as good_rows on good_rows.title = bad_rows.title and good_rows.min_id <> bad_rows.id;
Here are the return lines
id| title | text_desc | created ------------------------------------------------------- 2 | The title | description here 1 |2012-02-21 10:58:58 3 | The title | description here 3 |2012-02-21 10:58:58
user1127128
source share