I am fetching account lookup value in class using inner soql query but it throwing error

Compile Error: No such column 'Account' on entity 'Case'. 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"

 String con_Email = envelope.fromAddress;

    //write soql and checking sender email & existing email of contact same
    List<Contact> conList = [SELECT Id, AccountID, Block_Email__c, Email, (SELECT Account FROM cases) FROM contact WHERE email =: con_Email LIMIT 1];

enter image description here

  • Did you not solve this problem? It seems based on your subsequent question like this issue is resolved.
    – Adrian Larson
    Feb 13, 2017 at 15:33
  • yes its resolved, sorry for forgot best answer Feb 14, 2017 at 8:27

1 Answer 1


The actual field API Name is AccountId, as you can see in the documentation for the Case object. So the correct sub-query would be:

(SELECT AccountId FROM Cases)

You can pull other fields through the Account reference, but you can't just pull the object itself. For example this query will compile and run just fine:

(SELECT Account.Name FROM Cases)

You must log in to answer this question.

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