I am having a Dirty database and i have to clean it, by first extracting city name from the address (which is written with several variation) and then standardize spelling the city name and replace all the data with standardize city name
I have made a Cities_look up table. in which all possible city name variations are written this table is having 2 columns for example
Standard_City_Name Dirty_City Name
NEW YORK NEW
NEW YORK NY
NEW YORK newyork
NEW YORK New york
NEW YORK ny
NEW YORK NWYK
now i have to Trim city name from the address by looking up in this table comparing all the values in Dirty_City_Name column then triming it out. and then make new column of city and write there the Standard_City_Name
i am ding this
SELECT TRIM(TRIM(TRAILING Cities_lookup.Dirty_City_Name FROM Address) ), Cities_lookup.Dirty_City_Name
from Student left join Cities_lookup
on Student.Address like CONCAT('% ',Cities_lookup.Dirty_City_Name)
Can anyone help?