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
Pradeep Pradhan 21Pradeep Pradhan 21 

sort all the elements in multi column sort when it s in parent child relationship in apex

hello everyone i have tried this code . please help me out other best possible sloution


public class multicolumn_sort {
    public static void main(){
        list<Account> accList=new List<Account>();
accList=[select Name,(select Name from Contacts ) 
         from Account] ;
for(Account acc:accList){
    for(Contact con:acc.Contacts){
      System.debug('acc List-------->'+con.Name);
    }
}
    }
}
PriyaPriya (Salesforce Developers) 
Hey Pradeeo,

Kindly refer these below links :- 

https://salesforceglobe4u.blogspot.com/2020/03/how-to-display-account-and-its-related.html

https://www.w3web.net/display-account-related-contacts-in-lwc/

Thanks!