On 10/17/2016 9:54 AM, Daniel Polski wrote:
Let's say I have a table like this:CREATE TABLE table1( 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?
select unit, sum(1 << bit_position) from table1 where val group by unit; -- Igor Tandetnik _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

