Suppose we have a Customized salesforce object called Dummy__c, which have attributes Attr1__c, Attr2__c, Attr3__c etc, We want to get distinct values of Attr1__c. To achieve this, we can easily get distinct values of Attr1__c by using GROUP BY with COUNT_DISTINCT function:
SELECT Attr1__c, COUNT_DISTINCT(Attr__c) FROM Dummy__c GROUP BY Attr1__c
That's all. We do not need to load large number of records into our own application's memory and count unique values.
No comments:
Post a Comment