1

Why is this statement wrong? I got an error when executing this statement in developer console.

SELECT Id, Account_Name__r.Name, Account__r.Account_No__c  From CBR__c

CBR_ is a child object to Account and Account_Name__c is a lookup field to Account.

SELECT Id, Account_Name__r.Name, Account__r.Account_No__c  From CBR__c
                             ^

ERROR at Row:1:Column:34

Didn't understand relationship 'Account__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

3
  • What do you mean by wrong? Are you getting any errors? Commented Jul 16, 2015 at 6:34
  • Yes, I got an error.
    – user7123
    Commented Jul 16, 2015 at 6:35
  • It will definitely help if you can you update the question with the error that you got Commented Jul 16, 2015 at 6:37

3 Answers 3

3

here is a little bit correction in your query

SELECT Id, Account_Name__r.Name, Account_Name__r.Account_No__c  From CBR__c

Cheers!!!

2

You are not using the correct api name of your lookup field in your query. thats why you are getting an error

Try using this :

SELECT Id, Account_Name__r.Name, Account_Name__r.Account_No__c  From CBR__c
2

The error is in Account__r,Since your lookup name is Account_Name__r.

Try below if Account_No__c is a custom field in Account object.

SELECT Id, Account_Name__r.Name, Account_Name__r.Account_No__c  From CBR__c

Thanks.

0

You must log in to answer this question.

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