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
swapna sree 3swapna sree 3 

write a child to parent query on opportunity and opportunity line item

write a child to parent query on opportunity and opportunity line item
Best Answer chosen by swapna sree 3
RituSharmaRituSharma
To query Opportunity data along with opportunity line items data using below Query:
Select Id,Name,(Select Id,Name from OpportunityLineItems) from Opportunity

To query Opportunity Line Item data along with Opportunity fields using below Query:
Select Id,Name,Opportunity.Name from OpportunityLineItem
 

All Answers

RituSharmaRituSharma
To query Opportunity data along with opportunity line items data using below Query:
Select Id,Name,(Select Id,Name from OpportunityLineItems) from Opportunity

To query Opportunity Line Item data along with Opportunity fields using below Query:
Select Id,Name,Opportunity.Name from OpportunityLineItem
 
This was selected as the best answer
Abhijit Das 59Abhijit Das 59
Thank you for this informative post. Check out me at schemebygovernment (https://schemebygovernment.com/)and vestigefamily (https://vestigefamily.net/)