You need to sign in to do that
Don't have an account?
MNRob
Help with SOQL - Field must be grouped or aggregated
Reading through other examples and I still can't see my issue.
SELECT CSR__r.name, sum(margin__c) FROM shipment__C WHERE Actual_Delivery_Date__c = this_month group by CSR__r.name.
If I drop the aggregate and group by my simple list comes back just fine.
Thanks in advance!
SELECT CSR__r.name, sum(margin__c) FROM shipment__C WHERE Actual_Delivery_Date__c = this_month group by CSR__r.name.
If I drop the aggregate and group by my simple list comes back just fine.
Thanks in advance!
Happy New Year!
Try Replacing the WHERE clause with the HAVING clause
For example
SELECT CSR__r.name, sum(margin__c)
FROM shipment__C
GROUP BY CSR__r.name
HAVING Actual_Delivery_Date__c = this_month
Please see this guide for more detail https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_having.htm
The only constraint is to have a groupable field and Name could not be:
Verify if your field is groupable with the developer console and the anonymous windows (CTRL + E)
If dfr.isgroupable() is false, you have used a field Name of type Auto Number probably.
The query below works fine and you have used this exact pattern for your query but the Name has a Text type for Account:
Best regards
Alain
I appreciate both of you taking the time to respond!
I assume you already validated there is data stored for that object ;)
Replacing the banks with a sign "+" in the query.
"Show Raw Response". and just copy/paste the response here without the cookie.
Alain