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

getting the data from child object

i want to get the data from child object

how can  i query the data



Thanks in advance.........







There are two types of SOQL queries that we can use :


1.      Child to parent

2.      Parent to child


If you want to get data from child object, then can use parent to child query. For an example Account and contact have parent- child relationship. For accessing data from contact query would be like :


List<Account> acc=[select id,Name,(select id,lastName,firstname from Contact) from Account limit 100];


This query returns 100 accounts and all contacts related to each account.


For more information go through this link-


Hope this helps.