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
Developer_shaanDeveloper_shaan 

Aggregate function exception

How can we limit the below query to a limit of 1000 records.Its throwing too many query rows exception if run directly.

Limit is also not working properly when  applied on queries with aggregate functions.

 

(select  SUM(Field__C) from contact where recordtypeid = ''xyz' );

 

If limit is applied along with groupby clause its is showing an error as Internal Salesforce.com Query Error


(SELECT id, SUM(Field__c) FROM Contact  WHERE recordtypeid = 'xyz' group by id Limit 1000);

 

Is this correct or do we have any other soln.

 

please let me know ASAP.

 

Thanks

shaan