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()
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()
use this link for IN clause in activeandroid. Its bit difficult but check the answer given by jlhonora. it worked for me
© 2022 - 2024 — McMap. All rights reserved.