Im have a database which saves user preferences in binary.
Chips = 1;
Pizza = 2;
Chinese = 4;
For example, if a user likes chips, then their preference will be 1. If they like pizza, their preference will be 2. If the like both, their preference will be 3. If they like chinese and chips, but not pizza, then their preference will be 5.
I need to create a mysql query where I can select all users who DO NOT like Pizza. I have attempted to solve this problem, but Im finding a lack of docs for using bit and in a where clause:
Logically, this makes sense to me, but this is not right:
SELECT * FROM `User` WHERE BIT_AND(preferences,2) != 2;