安卓:获取列最高值 [英] Android: Get highest value in column

查看:167
本文介绍了安卓:获取列最高值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个URL指向的内容,我需要得到包含在其中一列最高值。是否有任何聚合函数,将完成这还是我必须这样做手工?

I have an URL pointing to content and I need to get highest value contained in one of the columns. Is there any aggregate function that will accomplish that or do I have to do this manually?

推荐答案

如果你要查询一个Android内容提供商,你应该能够通过传递 MAX(列)中的选择参数 ContentResolver.query

If you're querying an Android content provider, you should be able to achieve this by passing MAX(COLUMN_NAME) in to the selection parameter of ContentResolver.query:

getContentResolver().query(uri, projection, "MAX(COLUMN_NAME)", null, sortOrder);

其中乌里是内容提供者的地址。这将返回与COLUMN_NAME最高值的单行。

Where Uri is the address of the content provider. This should return the single row with the highest value in COLUMN_NAME.

这篇关于安卓:获取列最高值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆