How to remove special characters from MySQL Database table column value?

Scenario is like this ,I have got a field value RIOZ EHG\’\’PAULO inside a column name of a table ‘my_cities’ in MYSQL Database.My Objective is ,when we select this column field in the query using JOIN ON some ‘LIKE’ condition ,The record consisting the name RIOZ EHG\’\’PAULO must be returned, it can be back slash \\ or any other special characters. But Since I use MYSQL 5.6 version,I didn’t find a way other than replace function.Below is the query I use. Please guide me .

SELECT a.a_town,a.a_country, a.a_code, sc.country_id, sc.name AS city_name,sc.id AS supplier_city_id         FROM           my_cities AS sc           INNER JOIN         address AS a       ON sc.country_id = a.a_country      AND trim(a.a_town) LIKE CONCAT(trim(sc.name), '%')       AND a.a_code = 'address_code' LIMIT 1 

In this query the sc.name will be having value RIOZ EHG\’\’PAULO .

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.