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
larvalarva 

Execute Anonymous

Using Execute Anonymous 
Debug all Accounts with the total number of contacts and one contact firstname

Get All Contacts with Accounts using Query Below 
Select Id, AccountId,FirstNAme from Contact WHERE AccountId !=null
 
Best Answer chosen by larva
CharuDuttCharuDutt
Hii Larva
Try Below Code In Anonymous Window
list<Account> lstAcc = [Select Id,Name,(select Id,FirstName from Contacts where AccountId != null) from Account];
for(Account Acc : lstAcc){
  
    for(Contact con : Acc.contacts){
    system.debug(Acc.Name + ' ' + Acc.Contacts.Size()+' '+Con.firstName );
    }
}
Please Mark It As Best Answer If It Helps
Thank You!