How do I create a SOQL GROUP BY using custom field?
For example:
SELECT id, name, Cultura__c
FROM SC_VPM__c
GROUP BY Cultura__c
This returns an error:
MALFORMED_QUERY.
How do I create a SOQL GROUP BY using custom field?
For example:
SELECT id, name, Cultura__c
FROM SC_VPM__c
GROUP BY Cultura__c
This returns an error:
MALFORMED_QUERY.
Best Answer
You should be able to group with a custom field just like a standard one. The main difference is the result from a group by query is that it becomes an AggregateResult sObject.
Salesforce Documentation of SOQL GROUP BY: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/langCon_apex_SOQL_agg_fns.htm