Using SQL I would like to create something like a loop on a database which has city names and search for each city in another database and if it matches than I want the corresponding latitude and longitude to be added to the first database.
I don't know how to do that using SQL alone without PHP.
One of the databases is a wordpress database, inside it there is a table called wp_postmeta has 4 columns :
meta_id, post_id, meta_key, meta_value.
So here I want all the meta key cities to loop though them like :
SELECT meta_value FROM wp_postmeta WHERE meta_key = "city"
And I want to search with this values inside another database in the same server called GEO :
ID, city_name, lat, long.
So if city_name in second db matches city I want the lat and long from the second db to be added to the first one.
Any help would be appreciated.