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