+ Start a Discussion
venkateshyadav1243venkateshyadav1243 

soql sub quer error

Hi

 

i have two objects  quote (parent ),purchase order(child)

 

am writing sub query but am getting error

 

please tell me can any where am missing

 

List<Quote__c> quotes = [Select id,Height__c,Width_Forula_C2__c,(select id,Height_Num__c,Quote__c,Product_Code__c,Width_Num__c from Purchase_Orders__r) From Quote__c where Id in: mapOrderIdAllsco.keyset()];

am getting this error

 





Didn't understand relationship 'Purchase_Orders__r' 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

 

 

regards

venkatesh

 

Best Answer chosen by Admin (Salesforce Developers) 
jiah.choudharyjiah.choudhary
@venkateshyadav1243,

The relationship names differ from the API names. Select this child query from eclipse IDE schema. You will get proper relationship names

All Answers

Abhi_TripathiAbhi_Tripathi

Hi,

 

try this

 

List<Quote__c> quotes = [Select id,Height__c,Width_Forula_C2__c,(select id,Height_Num__c,Quote__c,Product_Code__c,Width_Num__c from Quote__c.Purchase_Orders__r) From Quote__c where Id in: mapOrderIdAllsco.keyset()];

 

Go for this link for more information

http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_relationships.htm

 

 

Hit kudos (star) if this solution helped you

 

jiah.choudharyjiah.choudhary
@venkateshyadav1243,

The relationship names differ from the API names. Select this child query from eclipse IDE schema. You will get proper relationship names
This was selected as the best answer