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
Chaitra GVChaitra GV 

SOQL Query from parent to child

There are 3 objects, Account, Opportunity and Activity. How to query using SOQL in the below hierarchy using AccountId and OpportunityId fields.

Account

Opportunity

Activity

Raj VakatiRaj Vakati
Use this Query and change AccountID in where condition
 
SELECT Id, Name, Industry, AnnualRevenue,(SELECT Id from Opportunities) , (SELECT Id from OpenActivities) FROM Account where Id ='AccountId'