php - Mysql with regular expression -


i have query regarding regular expression.i have design table contain 3 column 1 column contain member ids separated commas.i showing table structure.please follow

send_id    member_id  1          1211,23,34 2          1,23 

i want select send_id 2 data contain member_id 1.

this query using

select * table column regexp '^[1]+$'; 

but query giving me both row.please me.

with regards

rahul

never store separate values in 1 column

normalize structure like

 send_id    member_id  1          1211 1          23 1          34 2          1 2          23 

if still want regex, be

select * t column regexp '(^|[^0-9])1([^0-9]|$)' 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -