Answer the question
In order to leave comments, you need to log in
Sampling by regular expression?
Hello! Please tell me: in my database table, the data is stored in this way: id | name | items
1 | test | '0, 2, 3'
2 | test2 | '1, 4'
3 | test3 | '5'
And I need to make a selection ( `id` - int, `name` - varchar, `items` - varchar
), for example, by the presence of the number 4 in items
. ВЫБРАТЬ `name` ГДЕ `items` СОДЕРЖИТ '4';
must issue test2
etc.
I apologize for such a chaotic question, but still.
Answer the question
In order to leave comments, you need to log in
In this case, it is more convenient to make a linked ordered_items table, this will greatly untie your hands when developing the project.
Add ", " at the beginning and end of the line, then use like:
select * from your_table where concat( ', ' , items , ', ' ) like ', 4, '
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question