我正在尝试进行查询,而选择应该是:
String select = Contacts._ID + " = " + ids.get(1) + "";
但是代替ids.get(1)
应检查每个项目......例如ids.get(1)OR ids.get(2)OR ids.get(3)...... etc ......
答案 0 :(得分:2)
在parens中使用带有逗号分隔列表的IN
,如
Contacts._ID + " IN(" + TextUtils.join(",", ids) + ")"
答案 1 :(得分:1)
只需使用for循环并每次执行查询:
for(int i=1; i<ids.length; i++){
String select = Contacts._ID + " = " + ids.get(i) + "";
//execute query
}
或者您是否尝试在2个值之间的单个查询中执行此操作?
SELECT Contacts._ID
FROM table_name
WHERE column_name BETWEEN value1 AND value2;