SOQL with Parent-to-Child Relationship
The second form of relationship query is the parent-to-child query. Listing 5-30 provides
an example.The parent object is Resource, and the child is Timecard.The query
selects from every Resource its Id, Name, and a list of hours from its Timecards in the current
month.
Listing 5-30 SOQL with Parent-to-Child Relationship
SELECT Id, Name,(SELECT Total_Hours__c FROM Timecards__r WHERE Week_Ending__c = THIS_MONTH) FROM Resource__c
No comments:
Post a Comment