How to set schema for generating the child-to-parent relationship query
This section demonstrates how to set the module name and schema columns for generating a child-to-parent relationship query.
The following two child-to-parent relationship query examples will be used for demonstration purpose in the following steps.
-
SELECT Name, Account.Name, Account.Owner.Name FROM Contact, a child-to-parent relationship query with standard object and fields, and
-
SELECT Id, FirstName__c, MotherOfDaughter__r.FirstName__c FROM Daughter__c, a child-to-parent 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.