i have a MySql database that contains two tables. One table (the 'Country' table) has a list of countries (the columns are unique_id and country_name). The other table (the 'State') table has a list of global regions (equivalent to the U.S' States). Columns in the States table are state_id, state_name, country_name).
I would like to convert all the country names in the 'State' table to the corresponding unique-id in the 'Country' table. Is there a way to do this?
Any help appreciated and thank you in advance.
If you need to select data to see unique id instead of country name you can use inner join
select StateId, StateName, UniqueId from states
INNER JOIN countries
ON states.CountryName = countries.CountryName;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments