Jump to content

Recommended Posts

Hello.. how do I select based on bitmasks?

 

I'm looking for something like.. select * from table where 16 in bitmask(field)

 

Edit: and I need to make sure that it will be indexed right of course so that it won't be slow. I'm guessing that indexing this column just like I would any other should work? Or is there something special I have to do for it to work for bitmasks?

Link to comment
https://forums.phpfreaks.com/topic/74590-select-bitmask/
Share on other sites

Thanks that will work ^^

 

I don't understand why I can't index it though.. I want it to be fast..

 

 

Would it be faster just to make add like 40 tinyint(1) rows?

How would you design such an index? It's like trying to index the 3rd and 6th letter of a CHAR field.

 

40 rows is a bad idea... bitmasks are a bad idea.

Link to comment
https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-378606
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.