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
Rohit Vaidya 3Rohit Vaidya 3 

soql to fetch 3 object

there are 3 objects(A,B,C) , these are connected through a relationship, A is parent with child B and GrandChild C. Write a soql query to fetch the data from all 3 objects in a single query?
VinayVinay (Salesforce Developers) 
Hi Rohit,

You can try something like below.
SELECT Name, (SELECT Name FROM C), (SELECT Name FROM B) FROM A WHERE Name = 'test'

Check below similar example that can help you.
https://salesforce.stackexchange.com/questions/111942/query-to-get-records-from-3-object-relationship

Please mark as Best Answer if above information was helpful.

Thanks,