Activity Forums Salesforce® Discussions What is aggregate Query in Apex?

  • MOHIT

    Member
    January 20, 2020 at 7:47 pm

    Aggregate functions in salesforce include AVG(), COUNT(), MIN(), MAX(), SUM().The functions like  SUM() and MAX() in SOQL allow to roll up and summarize the data in a query. The GROUP BY clause in a SOQL query is to avoid iterating through individual query results and used to specify a group of records instead of processing many individual records.

    AVG() – Returns the average value of a numeric field
    COUNT() – Returns the number of rows matching the query criteria
    MIN() – Returns the minimum value of a field
    MAX() – Returns the maximum value of a field
    SUM() – Returns the total sum of a numeric field
    A query that includes an aggregate function returns its results in an array of AggregateResult objects. AggregateResult is a read-only sObject and is only used for query results. The values in the AggregateResult object can be accessed much like a map calling a “get” method with the name of the column.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos