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
vijay aithavijay aitha 

vijay aitha i just want to know how to display no.of contacts names for one account record in a account object field using soql query..thanks in advance

Amit Chaudhary 8Amit Chaudhary 8
Please try below query
select id, name, (select id, name from Contacts) from account
Please check below post to learn about related SOQL
1) https://developer.salesforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com

Try below code
<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
    <apex:pageBlock >
          <apex:repeat value="{!accounts}" var="a">
<apex:pageBlockSection title="{!a.name}"></apex:pageBlockSection>
  <apex:relatedList list="Contacts" subject="{!a.Id}"/>
</apex:repeat>      
     </apex:pageBlock>
</apex:page>

Let us know if this will help you