You need to sign in to do that
Don't have an account?

Quick Question on Aggregate SOQL queries
Hello All,
This is the data setup in object Child__c
http://imgur.com/50arUIy,AO95lex#0
This is what I wanted to achieve :
http://imgur.com/50arUIy,AO95lex#1
As you can see I am able to achieve my desired output (Grouping based on parent__r.id) using the above query.
But I am not able to understand the role played "id" inside count().
What did "id" inside the count() operator do ?.
The same setup in a traditional SQL is straightforward as below.
SELECT Parent__r.id,count(*)
FROM Child__c
GROUP BY Parent__r.id
ORDER BY count(*) DESC
So can someone explain the role played "id" inside the SOQL statement ?
if you use id in count() operator than it count all the the child records under parent id, by using id in count() no record will count twice, so it show expect count.
All Answers
if you use id in count() operator than it count all the the child records under parent id, by using id in count() no record will count twice, so it show expect count.