0

我正在使用以下代码从我的 Android 表中删除一些行:

sqliteDb.delete("MYTABLE", "Tel" + " = ?", new String[] { "1" });

如何为以下 3 种查询类型调用此方法?

Delete from MYTABLE where Tel = 1 OR Tel = 2

Delete from MYTABLE where Tel = 1 AND Number = 2

Delete from MYTABLE where Tel = 1 OR Number = 2
4

2 回答 2

2

一般来说,类似:

String tableName = "MYTABLE";
String where = "Tel = ? or Number = ?";
String[] whereArgs = {"1", "2"};

如何选择 where ( "Tel = ? or Number = ?") 与不同版本 ( "Tel = ? AND Number = ?") 的一个版本完全取决于您:)

于 2012-09-15T06:10:41.160 回答
0

简单地说,你可以这样做。

sqliteDb.delete("MYTABLE", "Tel" + " = ? OR Tel" + " = ?", new String[] { "1",  "2" });
于 2012-09-15T06:10:28.110 回答