1

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?

asked Oct 7, 2020 at 16:33

1 Answer 1

0

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.

answered Oct 7, 2020 at 17:12
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.