I have a column named a
, and a column named b
.
I want to fill with an UPDATE ... SET b = ...
query the b column, so that it contains the first bit that a
has set to 1. Okay, you probably didn't understand, it's much easier to understand with an example:
a = 2508 = 0x9CC = 0100111001100
b = 4 = 0x4 = 0000000000100
a = 2080 = 0x820 = 0100000100000
b = 32 = 0x20 = 0000000100000
Is there a way to do this in pure SQL?