简体   繁体   中英

GROUP BY in ContentResolver.query

I need to use GROUP BY or similar in ContentResolver.query().

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.

What else can be done?

I need to use GROUP BY or similar in ContentResolver.query()"

There is no requirement for a ContentProvider that you did not write to support arbitrary SQL.

For previous Android versions in the selection field put something like this..."

There is no guarantee that this will work across all Android devices, as device manufacturers can and do change various system-supplied ContentProvider implementations.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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