Android rawQuery help
I was wondering how I could query my database of 1400 items and get only the DISTINCT
types and row ids. Below is the actual sql that I want to run by my program crash开发者_StackOverflowes if I dont return ids.
return mDb.rawQuery("SELECT DISTINCT Type from the_foods",null);
Any ideas?
I figured it out. I had to use the group by ("Type"):
return mDb.query(true, DATABASE_TABLE, new String[] {KEY_TYPE,KEY_ROWID,KEY_NAME},null, null, "Type", null, null, null);
精彩评论