Reputation: 17
I created 9 columns each which hold either a 0 or a 1 integer. They exist so that users can toggle certain things on and off. I'd like to get rid of these 9 columns and instead use only one column where i can hold 9 0's and 1's for the 9 things my users will toggle. So say i have 000000000 and my user decides to toggle the first function, how would an update query for table accounts
and column toggletimers
look like which would change the value to 100000000 and so on for the 9 numbers?
Upvotes: 1
Views: 54
Reputation: 12610
update accounts set toggletimers = toggletimers | (1 << (9-1)) where ...
Upvotes: 1