I need to fetch the string For reference
110_112_120_122_130_132_140_143_149_151_154_160_162_165_171_173_194_215_236_257_278_299
use this as a subjects
I am using the below query
select * from table_name where subjects like '%_21_%' ;
which is not showing desired result.
Note – 21 can come anywhere in the string in start 21_ or middle 21 or tail _21
2
Answers
_
is a special character while usinglike
and means exect one character, you have to escape it:For more information see https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html#operator_like