简体   繁体   English

ContentResolver.query 中的 GROUP BY

[英]GROUP BY in ContentResolver.query

I need to use GROUP BY or similar in ContentResolver.query().我需要在 ContentResolver.query() 中使用 GROUP BY 或类似内容。

For previous Android versions in the selection field put something like this: " 1) GROUP BY 1, (2 ", that is, the brackets themselves were closed. Its not works in android 10, where selection field looks like this: " WHERE ((is_pending=0) AND (is_trashed=0) AND (volume_name IN ( 'external_primary', '12f2-2310' ))) AND ((1) GROUP BY 1, (2)) ", ie on late AND.对于以前的 Android 版本,在选择字段中输入如下内容:“ 1) GROUP BY 1, (2 ",即括号本身已关闭。它在 android 10 中不起作用,其中选择字段如下所示:“ WHERE ( (is_pending=0) AND (is_trashed=0) AND (volume_name IN ('external_primary', '12f2-2310'))) AND ((1) GROUP BY 1, (2)) ",即后期 AND。

What else can be done?还有什么可以做的?

I need to use GROUP BY or similar in ContentResolver.query()"我需要在 ContentResolver.query() 中使用 GROUP BY 或类似的“

There is no requirement for a ContentProvider that you did not write to support arbitrary SQL.不需要您未编写的ContentProvider来支持任意 SQL。

For previous Android versions in the selection field put something like this..."对于以前的 Android 版本,在选择字段中输入类似这样的内容..."

There is no guarantee that this will work across all Android devices, as device manufacturers can and do change various system-supplied ContentProvider implementations.无法保证这将适用于所有 Android 设备,因为设备制造商可以并且确实会更改各种系统提供的ContentProvider实现。

What else can be done?还有什么可以做的?

Do the calculations and data manipulation client-side, as you would need to do when accessing any other data source (eg, REST-style Web service) that you do not control.在客户端执行计算和数据操作,就像您在访问您无法控制的任何其他数据源(例如,REST 样式的 Web 服务)时需要执行的操作一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM