There is a scenario where I need to query the Account records that has the associated contacts >= 100, Since accounts and contact are not Master Detail relation ship I could not create roll-up summary.
I tried a similar query from stack exchange from the previous Question however that did not worked.
Select id,(Select Id from Contacts)From Account Where Id IN (Select Account from Contact Where Name !='')
Best Answer
That can be a difficult query since Accounts and Contacts typically have a lot of records. There's a risk of running into the "Too many query rows" exception, but if you don't have too much data at this point, this query might work for you:
Apex:
Rest api: