WordPress Plugins > WP-PostViews

How to delete duplicates?

(1/1)

JonnyD:
I got over a 1000 posts so im wondering if there's a quick and easy way to delete duplicates?

JonnyD:
Here's how I did it:

SQL:


--- Quote ---delete from wp_postmeta
where meta_id in (
       select *
       from (
               select meta_id
               from wp_postmeta a
               where a.meta_key = 'views'
               and meta_id not in (
                       select min(meta_id)
                       from wp_postmeta b
                       where b.post_id = a.post_id
                       and b.meta_key = 'views'
               )
       ) as x
);

--- End quote ---

Navigation

[0] Message Index

Go to full version