MySql REGEXP to match two comma separated strings

前端 未结 1 1054
萌比男神i
萌比男神i 2021-02-09 14:18

I have a table containing following values :

id    |    value      |
-----------------------
1     | 1,2,5,8,12,20 |    
2     | 11,25,26,28   |    
------------         


        
1条回答
  •  [愿得一人]
    2021-02-09 14:56

    REGEXP '(^|,)(1|3|6|7|11)(,|$)'
    

    Will match all values containing one number of the sequence 1,3,6,7,11.

    You should not use one column to save several values. Normalize data!

    Edited answer

    0 讨论(0)
提交回复
热议问题