MYSQL SELECT LIKE "masks"
I'm using a field in a table to hold 开发者_Python百科information about varios checkboxes (60).
The field is parsed to a string to something like this
"0,0,0,1,0,1,0,1,..."
Now I want to make a search using a similar string to match the fields. I.e.
"?,?,1,?,?,1,..."
where the "?" means that it must be 0 or 1 (doesn't matter), but the "1" must match.
As i've seen the '%' is somewhat innapropriate for this case, don't?
Obviosly both strings have the same lenght.
Suggestions?
You can use the underscore (_) character to match a single character in the mask.
Taken from MySQL documentation.
精彩评论