从Android中现有的内容提供商查询DISTINCT记录 [英] Querying DISTINCT records from existing content providers in android

查看:54
本文介绍了从Android中现有的内容提供商查询DISTINCT记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要内容提供商提供的不同记录.

I want Distinct records from content provider.

我当前的代码:

String[] projection= {"_id","address"};
Cursor address =  getContentResolver().query(android.provider.Telephony.Sms.Inbox.CONTENT_URI,projection, null, null,"address ASC");

推荐答案

//在列名之前使用DISTINCT

//use the DISTINCT before the name of the column

String[] projection= { "DISTINCT _id", "DISTINCT address"};

Cursor address =  getContentResolver().query(android.provider.Telephony.Sms.Inbox.CONTENT_URI,projection, null, null,"address ASC");

这篇关于从Android中现有的内容提供商查询DISTINCT记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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