satcha
satcha

Reputation: 129

bitwise operation in sql

please can someone help me to understand this condition val1 & 11 = 0

SELECT val FROM table WHERE val1 & 11 = 0

available for more information. Thanks a lot

Upvotes: 0

Views: 228

Answers (1)

Salman Arshad
Salman Arshad

Reputation: 272446

11 is 1011 in base 2. The code selects rows where 1st, 2nd and 4th bits are 0. I.e. it will match where val1 in 0, 4, 16, 20, 32, 36, 48, ...

Upvotes: 2

Related Questions