I'm trying to insert a new row with some data for each value of a SELECT.
I leave the last query that has occurred to me but that obviously does not work:
SET @postid = (SELECT post_id FROM wp_postmeta WHERE meta_value LIKE '%barcelona%'); INSERT INTO wp_postmeta ( post_id, meta_key, meta_value) VALUES ( @postid, "geolocation_city", "Barcelona");
That is, what I want is for each result of the select to create a new row in the table wp_postmeta with the value meta_value = Barcelona and meta_key = geolocation_city and the post id should be that of each result of the select.
I hope to be explaining myself well.
Does anyone think of how to do it? Thank you very much.