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
jayamjayam 

getting the data from child object

i want to get the data from child object

how can  i query the data

 

 

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

 

 

 

 

 

Pradeep_NavatarPradeep_Navatar

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-

 

http://wiki.developerforce.com/index.php/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com

 

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_soql.htm

 

Hope this helps.