C
C
Caspanch2015-06-10 17:22:46
MySQL
Caspanch, 2015-06-10 17:22:46

How to find the occurrence of one string in another string using MySQL?

There is a string in the database like
1,2,3,4,5,6,7,8
Determine if this string contains elements
3,5
5,7
2,7,8
4,3,1,8
Is it possible to do this by means MySQL?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Filimonov, 2015-06-10
@DmitryPhilimonov

How to deserialize field value? - a question with the same essence. There is no way, any way to do it with the help of the database is a crutch, and a very good, real one.
LIKE should be used in other cases when you really need to find substrings in strings, but in your case we are talking about serialized data (judging from the example). You wouldn't use a regexp for this.
The answer to your question is no.

R
Rsa97, 2015-06-10
@Rsa97

Only reduction of base to a normal form will help. With the current record, nothing good will come of it.

N
NaN, 2015-06-10
@NaN

if strings are just like a list, then why not?
//3,5
//one

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question