Clear Terms from Taxonomy for Specific Post IDs?

So if you’re sure you want to delete the actual term as well as the relationship that assigns the term to the post, this will do it (tested and works for me):

delete term from wpterm_taxonomy term, wpterm_relationships rel 
where  term.term_taxonomy_id = rel.term_taxonomy_id and rel.object_id IN (1) ;

And obviously replace the ‘1’ there with how you’re selecting the post ID’s

I would strongly recommend you test this before running it with e.g. this query which will show which terms will be deleted before you do it! And take a database backup before you’re doing large deletes in case something goes wrong 😉

select term.term_taxonomy_id from wpterm_taxonomy term, wpterm_relationships rel 
where  term.term_taxonomy_id = rel.term_taxonomy_id and rel.object_id IN (1) ;

Again replace ‘1’ with however you create your list of post ID’s