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
Naresh_reddyNaresh_reddy 

need help on parent to child query

what we need to fetch all records present in paymentlineitems from payment,using parent to child nested relation ship query.
how to write this query?
can any one help me
please check below User-added image
sfdcMonkey.comsfdcMonkey.com
hi Naresh_reddy 
Try this type nested Parent to child query for your Requrment

Select Name, (Select Name, Price__c From Child__c) From Parent__c

Thanks :)
If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Salesforce seekarSalesforce seekar
payment -->grand parent 
  fields in payment: name
  
payment_schedule --->parent 
   fields payment_schedule : name
   
 Payment line item  -->child 
   fields in Payment line item : name , price__c 
 
here having  m-d relation ship between  payment line item (child ) and  payment_schedule (parent)  and a  m-d relation ship between   payment_schedule (child )and payment (parent)
 
 
grand parent (payment )----- > child (Payment line item) . 
 

@soni piyush : this is a nested query right ,  r u sure whether this will fet h the records of the child using parent to child rel ???
sfdcMonkey.comsfdcMonkey.com
payment -->grand parent 
  fields in payment: name , parent__r(lookup)
  
payment_schedule --->parent 
   fields payment_schedule : name , child__r(lookup)
   
 Payment line item  -->child 
   fields in Payment line item : name , price__c 

Select Parent__r.child__c, Parent__c From grandParent__c