Android call record deduplication Query Method

Source: Internet
Author: User

Recently, we have been studying the de-duplication of call record query data. We have been studying the getcontentresolver (). query method and made a little research on several parameters.

The method for removing the call record is found. You can use distinct (number) as distinct_number to retrieve only one column of data,

Cursor mcalllogcursor = getcontentresolver (). Query (calllog. CILS. content_uri, -------------- URI

New String [] {"max (date) as max_date", calllog. CILS. Number, calllog. CILS. Duration, calllog. CILS. Type}, ---------------- projection

"1 = 1) group by (number", ---------------- Selection

Null, ----------------- selectionarg

Calllog. CILS. default_sort_order); -------------- sortorder

The preceding statement is restored to an SQL statement, as shown in the following sentence.

Select max (date) as max_date, number, duration, type from callwhere (1 = 1) group by (number) order by date DESC

Implements the call record deduplication and query function (deduplication removes the call record before the specified time)

I personally understand SQL statement execution. The Select data selects max data from the table's Grop.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.