我想知道是否可能以及如何使用"IN"子句在ActiveAndroid中执行where子句.
例如,我想做这样的事情:
new Select().from(Table).where("id in?",list).execute()
rob*_*123 11
该查询应该按原样运行 - 无论如何,ActiveAndroid将SELECT缩减为SQL.
例如,以下LIKE查询适用于我:
public static List<Record> search(String searchTerm) {
return new Select().from(Record.class)
.where("Data LIKE ?", new String[]{'%' + searchTerm + '%'})
.orderBy("Name ASC")
.execute();
}
Run Code Online (Sandbox Code Playgroud)
其中搜索字词为'%searchTerm%'
如果遇到困难,可以直接查询DB,即:
mRecordList = SQLiteUtils.rawQuery(Record.class,
"SELECT * from Records where Data LIKE ?",
new String[]{'%' + searchTerm + '%'});
*/
Run Code Online (Sandbox Code Playgroud)