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.

1
  • In your GROUP BY clause try adding Account.Last_Meeting_date__c instead of Last_Meeting_date__c
    – highfive
    Commented Aug 3, 2016 at 5:45

1 Answer 1

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];
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .