I want to fetch multiple columns containing multiple values using a specific value from single table in PHP/MYSQL.
My table structure is like,
id | Name | s_id |
-----------------------------
1 | aaa | 3 10 13 |
2 | bbb | 1 2 5 8 16 23 |
3 | ccc | 1 3 11 19 25 |
4 | ddd | 7 15 19 25 |
5 | eee | 5 13 16 21 |
"SELECT Name FROM table where s_id like '%1%'"
bbb
ccc
'1'
i.e. 1, 11, 19, 16, etc.
Try this REGEXP '[[:<:]]1[[:>:]]'
"SELECT Name FROM table where s_id REGEXP '[[:<:]]1[[:>:]]'"