Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

select field with specific data between commas by regex

Tags:

regex

mysql

I have a table in MySQL with these data in it

enter image description here

I want to get rows with "1" in column row1 by regex. How should I do that?

([^,]1/)

i use this regex but it only return the rows with "1" in first comma

like image 254
Mohsen Morshedi Avatar asked Dec 14 '15 07:12

Mohsen Morshedi


1 Answers

You can use FIND_IN_SET() function of mysql

select * from my_table where FIND_IN_SET('1',row1) > 0
like image 74
Jay Dhameliya Avatar answered Sep 23 '22 03:09

Jay Dhameliya