0
我测试SQL,它在SQLite的间谍工作正常:关于Android的ContentResolver的查询组通过
select ifnull(_name, _number) as identifer, count(_id) as amount from call group by identifer
而且我想在ContentConsolver使用它,但它也不能“按组”一起工作:
String[] projections = new String[] { "ifnull(name, number) as identifer", "count(_id) as amount" };
String group = "identifer";
//String selection = ") GROUP BY (" + group;
Cursor cursor = getContentResolver().query(CallLog.Calls.CONTENT_URI, projections, null, null, null /*!group*/);
我该怎么办?
如果由'ContentResolver'查询的'ContentProvider'不与组由暴露的URI或支持了一些URI参数组的参数你将不得不做Java中的分组代码在读完'Cursor'的全部内容之后。 – Jens 2012-08-16 05:51:01
暂时解决,ICS出错! add:String selection =“1 = 1)GROUP BY(identifer”; – thecr0w 2012-08-16 06:56:59