How can I insert country names from table wp_agent_adds into table wp_agent_target_countries when field wp_agent_adds.countries has x country names per field separated with a ',' comma.
Means this should be the result after the insert:
id = AUTO_INCREMENT
add_id = 2
meta_key = 'country'
meta_value = 'Netherlands'
id = AUTO_INCREMENT
add_id = 2
meta_key = 'country'
meta_value = 'Germany'
id = AUTO_INCREMENT
add_id = 2
meta_key = 'country'
meta_value = 'Polen'
See examples below.
Source Table wp_agent_adds.countries:
id user_id countries
2 2 Netherlands,Germany,Polen
3 3 Netherlands
4 1 Netherlands,Belgium,Austria,Switzerland
7 100 Netherlands,Germany,Belgium
Target table:
wp_agent_target_countries (
id int(12) NOT NULL AUTO_INCREMENT,
add_id int(12) NOT NULL,
meta_key varchar(64) NOT NULL,
meta_value varchar(64) NOT NULL) ;