Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5531

cosmicjellybaby on "MySQL bulk delete query"

$
0
0

Hi, am trying to run MySQL query to delete posts in a given category older than a given date. I can select the relevant records using a query, but when I try to modify the query to make it a DELETE query it deletes all the posts from the category, regardless of date. Any clues? Is it just a simple problem?

delete a,b,c,d
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
WHERE e.term_id =110
AND post_date <'2013-01-01'

I have tried the bulk delete plugin, but it doesn't seem to be very stable.


Viewing all articles
Browse latest Browse all 5531

Trending Articles