I am adding location categories to posts based on keywords in title (with regex), I got it working once, so code is fine the first time, but now get SQL Error (1062) Duplicate entry '4419-268'
so I assume its because some fields already are filled because it worked once...what is the correct code for updating categories even when some might already have same one? my regex catches some already with that category
here is my current code
INSERT INTO wp_term_relationships (term_taxonomy_id, object_id) SELECT '268', ID FROM `wp_posts` WHERE (post_title REGEXP '€|E\\.U\\.|Euro|Europe|Germany|Deutschland|Berlin|Munich|München' OR post_content REGEXP '€|E\\.U\\.|Euro|Europe|Germany|Deutschland|Berlin|Munich|München') AND post_type = 'post'
cheers
Ben