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

Why can't certain fields be grouped in a Query Call????

I have an aggregate query and it appears that it does not like my query in visualforce but apex controller accepts it..

The error I get on my VF page is:

field 'Term__c' can not be grouped in a query call


My Query is:


AggregateResult[] groupedResultsD = [SELECT SARQ__r.Subject__c,NLNS__SARQ__r.Term__c, SUM(Credits_Earned__c) ce,SUM(SARQ__r.Min_Pass__c)minpass FROM Course__c Where Student__c = :students[0].Student__c GROUP BY SARQ__r.Subject__c,SARQ__r.Term__c];

Term__c is a formula field in my Object....






In your case it can be by two possible causes: fields "__r" or fields "groupable= false".

Check this entry for details: "Considerations when use Group By"



Message Edited by ParnisariPablo on 03-19-2010 07:31 AM

There is limitation Like Formula fileds can't use in group by Clause .