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
kab1kab1 

Need help on complex SOQL with multiple table join

I have objects Opportunity, OpportunityLineItem,  

 

CustomObject1( OpptyID , OwnerType, UserID)

 

Custom Object2(OwnerType, OptyLineItemType)

 

I wanted to have a query to get data from Opportunity and OpportunityLineitem based on ( Opportunity.Id=CustomObject1.OpptyId) and CustomObject1.OwnerType=CustomObject2.OwnerType and OpportunityLineItem.LineItemType=Custom Object2.OptyLineItemType)

 also aggregate the lines by  UserID of CustomObject1.

 

Please let me know if there is a workaround or I can use a single query. 

 

thanks in advance.