开发者

MYSQL SELECT LIKE "masks"

开发者 https://www.devze.com 2022-12-13 18:31 出处:网络
I\'m using a field in a table to hold 开发者_Python百科information about varios checkboxes (60).

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消