背景

需要在指定列中搜索所有包含 "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"});

参考:

SQLite | Where 子句
https://blog.csdn.net/weixin_45488228/article/details/104377915?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1.pc_relevant_paycolumn_v3&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1.pc_relevant_paycolumn_v3&utm_relevant_index=1

sqlite3学习之where子句&AND/OR 运算符&Like 子句&Glob 子句
https://blog.csdn.net/luyaran/article/details/86239843

标签: application

添加新评论