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.