开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜