Remove Duplicate title in database table mysql -
we have 2 tables called : "post" , "post_extra".
summary construction of "post" table's are: id, postdate, title, description.
and post_extra are: eid, news_id, rating, views
"id" filed in first table connected "news_id" second table.
there more 100,000 records on table, many of them duplicated. want keep 1 record , remove duplicate records on "post" table have same title, , remove connected record on "post_extra"
i ran query on phpmyadmin server crashed, , had restart it.
delete e post p1, post p2, post_extra e p1.postdate > p2.postdate , p1.title = p2.title , e.news_id = p1.id
how can this?
i think the id
maximum in case of highest posteddate
if can try code
delete post id in (select max(id) post group title)
Comments
Post a Comment