Mysql – Equivalent to BIT_OR function in SQLite

aggregateMySQLsqlite

I have code that runs against a MySQL database but the unit tests for the code use SQLite.

The issue is one code method uses a SQL query which aggregates using the BIT_OR function of MySQL. Is there an equivalent or a way to replicate its functionality in SQLite?

Best Answer

SQLite supports using the pipe symbol as a bitwise-OR operator, as in:

SELECT col1 | col2
FROM sometable;

So, if col1 contains 1 and col2 contains 2, the result would be 3.

Here's a SQLFiddle.uk demo showing how that works under SQLite 3.27.