Use the operator LIKE
in the WHERE
clause:
SELECT *
FROM tablename
WHERE user_id = ?
OR ',' || can_read_by || ',' LIKE '%,' || ? || ',%';
Change ?
with the user’s id that you want.
See the demo.
solved Opposite of WHERE IN SQlite with PHP [duplicate]