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
raghu123raghu123 

field 'name' can not be grouped in a query call.......

Guys......

 

   Please Help me....Getting this error.whern using aggeregate result.

 

    *******field 'name' can not be grouped in a query call*****

 

 Thank You,

 

  

mikefmikef

This is straight from the docs:

 

Note the following when you are creating queries with a 

GROUP BY clause:

 

  • Some object fields have a field type that does not support grouping. You can't include fields with these field types in a GROUP BY clause. The Field object associated with DescribeSObjectResult has agroupable field that defines whether you can include the field in a GROUP BY clause.
  • You must use a GROUP BY clause if your query uses a LIMIT clause and an aggregated function. For example, the following query is valid:
    SELECT Name, Max(CreatedDate)
    FROM Account
    GROUP BY Name
    LIMIT 5

    The following query is invalid as there is no GROUP BY clause:

    SELECT Max(CreatedDate) FROM Account LIMIT 1
  • You can't use child relationship expressions that use the __r syntax in a query that uses a GROUP BY clause. For more information, see Understanding Relationship Names and Custom Objects and Custom Fields.
I looked and on account the name field is not groupable, please check the name field on the object you are working with. My guess is all sobject name fields are not groupable.