Android Sqlite查询在4.0中运行,但在2.3中不运行

时间:2013-11-27 14:36:36

标签: android sql android-sqlite

我在Android中的数据库上运行以下查询

SQLiteDatabase db = this.getWritableDatabase();
Cursor c;

String Query = "Select * from SubCategory_List where CatId = (Select _id from Category_List where Name = ?) order by Name ASC";

c = db.rawQuery(Query, new String[] { CatName });

我使用此光标填充listview。在android 4.0中我获得了所需的输出,但是在2.3中没有显示vales。

1 个答案:

答案 0 :(得分:0)

改变这个:

String Query = "Select * from SubCategory_List where CatId = (Select _id from Category_List where Name = ?) order by Name ASC";

由此:

String Query = "Select * from SubCategory_List where CatId IN (Select _id from Category_List where Name = ?) order by Name ASC";

(更改=进入IN)