function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dujsudujsu 

Parent to Child SOQL Query Help

We have got a custom child object called Billed_Account__c that contains a lookup (Custom_Account__c) field to the Account object and I am trying to write a query to get the child records from the parent.

 

So here is the latest SOQL query that does not work...

 

Select Id, Name, (Select Id, Name From Customer_Account__r) From Account 

 

Im receiving the following error: "INVALID TYPE:...Didn't understand relationship 'Customer_Account__r' in FROM part of query call......."

 

Any advice is appreciated.

 

Thanks!

 

 

 

 

 

PremanathPremanath

Hi you can try this,

 

Select Id, Name, (Select Id, Name From Customer_Accounts__r) From Account 

sfdcfoxsfdcfox

You need to look at the Billed_Account__c's field named Custom_Account__c and verify the child relationship name.