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
Sarvesh  SharmaSarvesh Sharma 

how many aggregate functions can be used in the SOQL query?

I am trying to write a grammar for parsing a SOQL query and while doing that I faced a problem where I need to find the maximum number of Aggregate functions (SUM (FieldName), COUNT (FieldName),... etc.) can be used in a single select clause of a SOQL query. Any help we appreciated. Thanks in advance!!!!!!
SantoshChitalkarSantoshChitalkar
Hi Sarvesh,

As per the salesforce documentation, Queries that include aggregate functions are subject to the same governor limits as other SOQL queries. So I think you can use # agregate functions == #fields.

Santosh
pankaj kabra 8pankaj kabra 8
No such limit, just limit of total number of characters used in soql query.
Sarvesh  SharmaSarvesh Sharma
So, it means i can use any number of fields as long as it is within the limit of 20k characters
SantoshChitalkarSantoshChitalkar
Yes.
pankaj kabra 8pankaj kabra 8
Don't forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help