function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
srinivasarao Muppanenisrinivasarao Muppaneni 

soql query to retrieve all accounts having more than 100 contacts in one query

soql query to retrieve all accounts having more than 100 contacts in one query

[select id,name,(select accountid,count(id) from contact group by accountid having count(id)>100) from account]
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Srinivasarao,

 To retrieve all accounts having more than 100 contacts in one query.
Select AccountId from Contact group by AccountId having count(Name) > 100

Please refer the below link for reference. I hope it will be helpful.

Best Regards
Rahul Kumar

 
srinivasarao Muppanenisrinivasarao Muppaneni
thanks rahul
why count(name) is used cant we use count(id)