my problem is pretty much the same with this, but i'd like to do it using mysql.
find cities and country name from string
I have a table called cityList contain distinct city name in my country. When user insert an address, such as "12345 streetname st santa clara ca", i'd like to split between the address, city name, and state. "12345 streetname st", "santa clara", "ca" and insert it into another table.
i tried using substring_index to split all the word, and using cursor in stored procedure to check whether each of the text in the string is in cityList. i have problem with city that have than 1 word, such as "san diego" "santa clara" "rio de janeiro". Is there any better and simpler solution? thank you