3

I have an object which captures searches made by users. It has a Searc_Phrase__c field. Each record captures one search attempt - the phrase, the use id and the date.

I want to query how many times each phrase was used in a search but count only unique users e.g. if a user searched multiple time for the same phrase count only 1.

Can I do that with SOQL?

1 Answer 1

9

Have you tried something like below?

SELECT Searc_Phrase__c, COUNT_DISTINCT(UserID)
FROM CustomObject
GROUP BY Searc_Phrase__c 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .