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
IT Admin 179IT Admin 179 

soql define parent / child relationship table

Hi ,

How to custimize/define  parent / child relationship tables  for ones that or not  defined by salesforce?

How to utilize  __c  and __r?

Thanks

 
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi IT Admin,

May I request you please check the Salesforce documentation on  "SOQL Relationship Queries" check below link.  
Basic Examples of SOQL RELATIONSHIPS:
Child > Parent (Standard Object)
Selectid,Account.Name,Account.Phone,Account.industry,Account.Type,Account.Rating,Account.website,Account.Ownership,Account.AnnualRevenue,Account.NumberOfEmployees,Account.CleanStatus from Contact


Child >Parent(Custom Object)
 
Selectid,COLLEGE__r.Name,COLLEGE__r.Contact__c,COLLEGE__r.Count__c,COLLEGE__r.Highest_Marks__c,COLLEGE__r.Address__cfrom Studnt__c



Parent >Child(Standard object)
select Name, Industry, (select AssistantName, Email from contacts)from ACCOUNT


Parent >Child (Custom Object)
select id,Name,(select Studnt__c.name__c from Studnts__r) from College__C
I hope it will be helpful.

Please mark it as best answer if the information is informative.


Best Regards
Rahul Kumar