0

I have this query:

[SELECT SUM(Amount) total, owner.Name ownername, Name oportunityname, Account.Last_Meeting_Date__c from Opportunity o where ownerid =: u.id GROUP BY ownerId, owner.Name, Name, Last_Meeting_date__c];

I added this field Account.Last_Meeting_date__c and when I try to save this Apex Class show me this error

Error: Compile Error: No such column 'Last_Meeting_date__c' on entity 'Opportunity'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 19 column 24

And I need get the Last Meeting Date from any Opportunities.

Any idea. Thanks.

  • In your GROUP BY clause try adding Account.Last_Meeting_date__c instead of Last_Meeting_date__c – highfive Aug 3 '16 at 5:45
3

You are using Last_Meeting_date__c while grouping the records.This is a field of account. Modify your query as follows.

[SELECT SUM(Amount) total, owner.Name ownername, Name oportunityname,Account.Last_Meeting_Date__c 
 from Opportunity o where ownerid =: u.id 
 GROUP BY ownerId, owner.Name, Name, Account.Last_Meeting_date__c];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.