It's the first time that I'm trying to achieve this kind of select.
I have a column on my table that stores values like 1,3,45,32,47,4,9,100,23,2
I want to make a select
and retrieve just the values that match for example 4
but not 45
on all lines of table.
some times this column just have one number like 4
if i make a selection using LIKE %4,%
the SQL only will retrieve values of the first example and the records that have just one number won't appear.
if i use LIKE %4%
SQL will retrieve 4, 45, 47
if i use REGEX '^4$'
SQL only will retrieve 4
from both examples...
Any help?
P.S: Sorry my english I'm from Brazil!
1,3,45,32,47,4,9,100,23,2
4
.Change your where clause like the following:
where column_name like '4' or column_name like '4,%' or column_name like '%,4,%'
and it should be working.