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:
So, if
col1
contains1
andcol2
contains2
, the result would be3
.Here's a SQLFiddle.uk demo showing how that works under SQLite 3.27.