我是Android的新手。 實際上,我想從內容提供商&內容解析器查詢媒體提供商的數據。如何使用「group by」選項從MEDIA提供程序進行查詢?
c = mContent.query(CONTENT_URI,projection,where,null,null);
我的問題是,我怎麼可以查詢從媒體提供的數據如下使用GROUP BY
條款:
select DISTINCT _id, count(_id), _data FROM aaa_table WHERE _data LIKE "A" OR _data LIKE "B" GROUP BY _id;
我已經嘗試設置projection
和where
如下:
final String[] projection = new String[] {
"_id",
"COUNT ("+ _id +")" ,
"_data"
};
和where
:
_data LIKE "A" OR _data LIKE "B"
但是,我找不到如何設置查詢選項GROUP BY _id
。
請幫幫我。
內容提供商集團通過在這裏實現:https://github.com/novoda/SQLiteProvider – Blundell 2012-11-27 10:38:30