user3264863 user3264863 - 1 year ago 41
SQL Question

how to search record in mysql with special characters

I use MySQL where in table i have three record like this


Now i want to search where it finds word '10%' in record. so here it should return only "ABC10%DEF". But it shows me two record "ABC10%DEF" and "XYZ10GKSLK" because in search term i have used % sign. How to ignore this "%" in search result so that it can consider % as searching character rather than wildcard characters.


You shuould escape the %

 select * from my_table 
 where my_column like '%10\%%'