0

I have a SET column that has 10 values, and I'm querying against a specific row that has 2nd and 10th values set, therefore, it's 514 (1000000010).

Now, I encounter an issue that, the result is different whether SET is involved.

SELECT b'1000000010' & ~(1<<9)

↑ This returns 2. (expected)

SELECT Tags & ~(1<<1) FROM Table
    WHERE Tags & (1<<9) = (1<<9);

↑ This returns 512. (expected)

SELECT Tags & ~(1<<9) FROM Table
    WHERE Tags & (1<<9) = (1<<9);

↑ This returns 0. (unexpected, expecting 2)

Why?

Akina
  • 39,301
  • 5
  • 14
  • 25
Ren
  • 79
  • 7

0 Answers0