0

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

satcha
  • 129
  • 1
  • 13
  • 3
    Does this answer your question? [What does "&" means in this sql where clause?](https://stackoverflow.com/questions/15289955/what-does-means-in-this-sql-where-clause) – Peter B Aug 11 '21 at 12:57
  • What about yh operation don't you understand here so we can try to fill in your blanks. – Thom A Aug 11 '21 at 13:01

1 Answers1

2

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, ...

Salman A
  • 262,204
  • 82
  • 430
  • 521