I have a cell value in mysql table 85,77,25
datatype is VARCHAR. I'm targeting to select all having 85 identically, but I'm thinking if the 85 value increase to 185
or other number more than 185 that also contain 85, and I'm using LIKE
operator in where clause. How can I properly select all of cell value having 85 only not 185, 285 and so on.
Example I have 4 rows and the value is
1. 20,85,77
2. 85,60,120
3. 10,4,85
4. 50,61,285
I need to get only those having '85' so the result should be from 1 to 3, I'm trying to combine LIKE operator beginning,ending and containing.
SELECT * from icweb.tbl_message
where
(to_id LIKE '%85' and to_id LIKE '85%' and to_id LIKE '%85%')