How to delete rows in SQLite with multiple where args?

前端 未结 6 898
陌清茗
陌清茗 2021-02-01 04:59

I want to delete rows which satisfy any of multiple conditions.

For example, I pass a list of IDs, and I want to delete all rows with these IDs (IDs are uni

6条回答
  •  抹茶落季
    2021-02-01 05:41

    You may get it done through db.execSQL method and SQL's IN keyword. For example:

    String args = TextUtils.join(", ", ids);
    
    db.execSQL(String.format("DELETE FROM rows WHERE ids IN (%s);", args));
    

提交回复
热议问题