sqlite where 指定列满足多个条件中的一种
背景
需要在指定列中搜索所有包含 "x", "y", "z" 的数据,和不包含他们的数据
实现
- 不包含他们的数据:
String find = "SELECT " + "*" + " FROM " + "analysisInfo" + " WHERE " + "stripId" +
" not in ( ?, ?, ? )";
Cursor cursor = db.rawQuery(find, new String[]{"x", "y", "z"});
- 包含他们的数据
String find = "SELECT " + "*" + " FROM " + "analysisInfo" + " WHERE " + "stripId" + " in ( ?, ?, ? )"; Cursor cursor = db.rawQuery(find, new String[]{"x", "y", "z"});
参考:
sqlite3学习之where子句&AND/OR 运算符&Like 子句&Glob 子句
https://blog.csdn.net/luyaran/article/details/86239843