+ Start a Discussion

Regarding subqueries in soql

HI All, I tried a lot.But didn't get the solution.


           I have a custom objects Registration_level__c and Attendee_Session__c. The  Attendee_Session__c custom object has lookup field of Registration_level__c.


           How can I display the related list of Attendee_Session__c which is in Registration_level__c detail page in a visualforce page.



Kindly help me. If you need any more information please let me know.




Himanshu ParasharHimanshu Parashar

User following code


 <a name="Give some name here" id="define id here"></a>            <apex:relatedList list="Childrelationshipname" rendered="true"/>


HI Thanks for the reply. But I am asking how to retrieve related list in soql in apex. And I want to display them in visualforce page.



Naresh B


previous poster is correct, if you're using the standard controller you can achieve this is one line of visualforce (relatedList tag)


otherwise, to select child records in SOQL looks like this example:


SELECT Name, (SELECT LastName FROM Contacts) FROM Account