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?

9

Have you tried something like below?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.