The problem of binary bit Operation as query condition in MySQL

the sum of the binaries stored in the mode field of the

table, why do you find the data record of mode=28 using the query condition where mode & 5?
where mode & 5 and where mode & 1 and mode & 4 query results are different, is there a boss to help with the specific analysis?

Jul.01,2022

28=1C=00011100 , 5000000101 , 28 & 5 = 00000100 = 4 , 4 = TRUE , so it was found out. Do 28 & 1 = 0 , 28 & 4 = 4 , 0 & 4 = 0 = FALSE alone, so you can't find out. A simpler approach is where mode & 5 = 5

Menu