How to set schema for generating the parent-to-child relationship query
This section demonstrates how to set the module name and schema columns for generating a parent-to-child relationship query.
The following two parent-to-child relationship query examples will be used for demonstration purpose in the following steps.
-
SELECT Name, Owner.Name (SELECT CreatedBy.Name FROM Notes) FROM Account, a parent-to-child relationship query with standard object and fields, and
-
SELECT LastName__c, (SELECT FirstName__c FROM Daughters__r) FROM Mother__c, a parent-to-child relationship query with custom object and fields.
Note that here you must use the relationship name with __r instead of __c. For more information, see Understanding Relationship Names, Custom Objects, and Custom Fields.