Let's say I have a table like this:

    id                INT,
    unit                INT,
    bit_position    INT,
    val                BOOL

INSERT INTO table1 VALUES(1,1, 0, 1);
INSERT INTO table1 VALUES(2,1, 1, 1);
INSERT INTO table1 VALUES(3,1, 4, 1);
INSERT INTO table1 VALUES(4,1, 7, 1);

INSERT INTO table1 VALUES(5,2, 0, 1);

The "bit_position" represent individual bits in bytes, and "val" represent if the bit should be set or clear (unit 1= 0b10010011, unit 2=0xb00000001 for the data in the above table).

How can I get the byte data in a single select instead of parsing through the individual bits one by one?

Requested select output example:
unit, byte
1, 147
2, 1

sqlite-users mailing list

Reply via email to