classic wordpress structure
wpdb_term_relationships table
object_id
term_taxonomy_id
I want to remove term_taxonomy_id = 3 from all posts that have term_taxonomy_id 1424 but exclude the ones that also have term_taxonomy_id 3152.
query that does not work:
DELETE FROM wpdb_term_relationships WHERE term_taxonomy_id = 3
WHERE ID IN (
SELECT object_id
FROM wpdb_term_relationships
WHERE term_taxonomy_id = 1424
)
AND ID NOT IN (
SELECT object_id
FROM wpdb_term_relationships
WHERE term_taxonomy_id = 3152
)
what am i doing wrong?