我尝试运行的Android以下原始查询,似乎无法正常工作
I try to run the following raw query in android, it seems not work
String query ="SELECT DISTINCT category FROM event";
Cursor cursor = mDb.rawQuery(query, null);
if (cursor != null) {
cursor.moveToFirst();
}
return cursor;
所以我决定使用query()方法中的Android这是类似于
so I decide to use the query() method in android which are something like
Cursor mCursor = mDb.query(EVENT_TABLE, new String[] {KEY_ROWID, KEY_CAT}, null, null,null,null, null)
谁能告诉我怎么不是rawquery来选择不同的类别,使用查询(),请,任何帮助将大大AP preciated!
Can anyone show me how to select the distinct category for using query() instead of rawquery please, any help will be greatly appreciated!
您可以使用this方法:
public Cursor query (boolean distinct, String table,
String[] columns, String selection,
String[] selectionArgs, String groupBy,
String having, String orderBy, String limit)
下面的第一个参数指定是否使用不同的或没有。
Here first argument specifies whether to use distinct or not.
上一篇:支持Android v23.1.0更新中断NavigationView获得/找到头Android、NavigationView
下一篇:错误的片段ViewPager接收onContextItemSelected电话片段、错误、电话、ViewPager