0

I have the next SOQL:

    SELECT Ap_Mat__c,Ap_Pat__c,Email__c,Cuenta__c,Nombres__c, Scheme__c
 FROM Asociado__c LIMIT 100

Where Cuenta__c is a master-detail field and Cuenta__c is the master(Account). On my SOQL I want the Account's name but this return the ID. I try to change to:

 SELECT Ap_Mat__c,Ap_Pat__c,Email__c,(SELECT Account.Name FROM Account), Cuenta__c,Nombres__c, Scheme__c FROM Asociado__c LIMIT 100

And get this error: "idn't understand relationship 'Account' in FROM part of query call. 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". Or change to this:

 SELECT Ap_Mat__c,Ap_Pat__c,Email__c,Account.Name , Cuenta__c,Nombre_s__c, Scheme__c FROM Afiliado__c LIMIT 100

Also getting error: "Didn't understand relationship 'Account' 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."

I need the same for , Scheme__c field. it's also a master-detail field where , Scheme__c is the master in a custom objet. Could you help me please. I do not quite understand how to structure the query

3
  • You want Cuenta__c.Name rather than (SELECT Account.Name FROM Account) if I understand the relationship correctly. Jul 31, 2015 at 17:04
  • 1
    Thank you very much. I didn't think so but it I worked, I switched only __c by __r in the master field name, so, my soql is: SELECT Ap_Mat__c,Ap_Pat__c,Email__c, Cuenta__r.Name , Nombre_s__c, Scheme__r.Name FROM Asociado__c LIMIT 100
    – marivel
    Jul 31, 2015 at 17:15
  • Excellent. I'll update this into an answer. Jul 31, 2015 at 17:27

1 Answer 1

1

You will want to update your query to have Curenta__r.Name rather than (SELECT Account.Name FROM Account) as it appears you are querying a parent field rather than a child field.

You must log in to answer this question.

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