I'm having trouble "Googling" this one, but hopefully it's not too tricky for an expert (or even an intermediate).
Is there a way to search for a substring within an unknown number of multiple OR conditions?
The original query for the Android SQLite Room Persistence DAO is:
SELECT country FROM table WHERE country IN (:searchList)
Which, given a searchList of ['Paris, France', 'Berlin, Germany'] would translate to the SQL:
SELECT country FROM table WHERE country IN ( 'Paris, France', 'Berlin, Germany' );
And would return: ['Paris, France', 'Berlin, Germany']
However, I would like to be able to search by just the country. For example, given a searchList of ['France', 'Germany'], I unfortunately get no result.
I understand the following SQL would do the trick:
SELECT country FROM table WHERE country LIKE '%France%' OR country LIKE '%Germany%';
However, because I don't know how many elements would be in the searchList, I have to use the original format:
SELECT country FROM table WHERE country IN (:searchList)
Is there any way to make the above search for a substring within the country column?
Many thanks for your help,
Dan