You need to sign in to do that
Don't have an account?
Luke Higgins 23
Help building SOQL nested query with a COUNT()
I am trying to return placements that occur in the query more than once and I am getting the error "Only root queries support aggregate expressions." Is there another way to count the placements than using a nested query? I know that GROUP BY is not supported in the sub-query but I'm unsure how else to go about it.
Here is what I have so far:
Here is what I have so far:
SELECT jstcl__Placement__r.Name, (SELECT COUNT(Name) FROM Placements__r Group By Id COUNT(NAME) > 1) FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c IN ('Active') AND jstcl__Week_Ending__c = LAST_N_DAYS:14 AND jstcl__Status__c = 'Pending'
Sample SOQL - http://www.infallibletechie.com/2018/04/how-to-count-child-records-for-each.html