How do I compare (AND) two strings which represent a binary mask in mysql?
问题 I have a table in mysql which stores (among other columns) a bitmask as a string, for example: 000100 I'd like to perform a query which will AND these fields together to provide a result that shows when any two mask positions are both true. As an example, consider these three sample records: id name mask == ==== ==== 11 a 000100 12 a 000110 13 a 010000 This query is a self-join. I am looking for records where, for a given name , the same bitmask occurs twice or more. In the above example, the