Need sql to remove tags from older posts

Well, think splitting the task in multiple pieces. First we need to get the post id’s which has the category with id 705 and then we’ll remove the tags from those posts.

Now if we transform this idea in to SQL then the query will be-

DELETE wp_term_relationships FROM wp_term_relationships
INNER JOIN wp_term_taxonomy ON ( wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id )
WHERE wp_term_taxonomy.taxonomy = 'post_tag' AND wp_term_relationships.object_id IN (SELECT id
FROM (SELECT wp_posts.id FROM wp_posts
       INNER JOIN wp_term_relationships
               ON wp_term_relationships.object_id = wp_posts.id
       INNER JOIN wp_term_taxonomy
               ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
       INNER JOIN wp_terms
               ON wp_term_taxonomy.term_id = wp_terms.term_id
WHERE wp_terms.term_id = 705 AND wp_term_taxonomy.taxonomy = 'category' ) AS posts)

This is tested. Don’t forget to backup the DB first. Anyway, the table prefix(wp_) may vary based on settings. So please check the table prefix before running the query.

Hope that helps.