I would like to know if it is possible and how I could do a where clause in ActiveAndroid with a "IN" clause.
For example, I would like do do something like this:
new Select().from(Table).where("id in ?", list).execute()
The query should work almost as is - ActiveAndroid reduces your SELECT to SQL anyway.
For example, the following LIKE query works for me:
public static List<Record> search(String searchTerm) {
return new Select().from(Record.class)
.where("Data LIKE ?", new String[]{'%' + searchTerm + '%'})
.orderBy("Name ASC")
.execute();
}
where search term is '%searchTerm%'
If you are having difficulty, you can query the DB directly, ie:
mRecordList = SQLiteUtils.rawQuery(Record.class,
"SELECT * from Records where Data LIKE ?",
new String[]{'%' + searchTerm + '%'});
*/
new Select().from(Table).where("id in (1,2)").execute()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With