There is a table:
CREATE TABLE n_dummy (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
`values` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
INSERT INTO `n_dummy` (id, `values`) VALUES
Look like this:
id | values
2 | 2,10
10 | 2,10
3 | 7,3
The first column is the integer to be searched in string from
Note: Example is too simplified and looks stupid. Refactoring table structure is not the way. Only sql query with standard functions and procedures.
I want to search integer value in string, concatenated from integers with
I expects MySQL to do this with
WHERE id IN(
And result would be
. But MySQL returns only
, the second and other values is not searchable with IN operator with string.
How to search integer in concatenated string using sql-query and prebuild routines?