There are two type SOQL Query in Salesforce:-
Parent to Child (Inner Query):-
Child to Parent:-
- Sometime we want to fetch few fields of the parent record while working with child record then we go for child to parent query.
- For example, working with contacts records user need the Account Shipping Address then for this use case SOQL will Look like below.
- SELECT Id, Name, AccountId, Account.ShippingAddress From Contact.
- In the above SOQL Account is the Field Name for Lookup/Master Details on the Contacts (Child) Object.
Parent to Child (Inner Query):-
Why we use parent to child Inner Query?:-
- Whenever we want to retrieve the related/child record for particular parent record or set of parent record then use the concept of Inner Query.
- For example, we want to retrieve the Contacts Related to particular Account then we will use below SOQL.
- SELECT Id, Name, (Select Id, Name From Contacts ) From Account WHERE Id IN: accList.
- Here is the above Query Contacts is Relationship Name. For standared Object it will always will be the Plural label of object name. For example, Contact => Contacts, Case = > Cases, Opportunity => Opportunities.
- For Custom Objects, We will append__r which will represent the Relationship with Account then in the Inner Query it will be Books__r.
To know more live demo source code in Salesforce lightning, Trigger, Visualforce & LWC, Use this link..
Type of SOQL Query in Salesforce
Reviewed by Admin
on
4:06 AM
Rating:
Good info.. Thanks fo posting
ReplyDeletenice thanks for sharing
ReplyDelete8th pass job in Bengali
Very Nice Information You May Also Like 1800tc microfiber sheets
ReplyDeletehttps://www.lifedreamguide.com/2020/03/what-is-difference-between-trigger-and.html?showComment=1605706148573#c1701986829320717786
ReplyDeleteThanks For Sharing The Amazing content. I Will also share with my friends. Great Content thanks a lot.click here
ReplyDeleteGood Info.
ReplyDelete5 Internet Approval Site (Do Follow Backlinks)
Thanks For Sharing The Amazing content. I Will also share with my friends. Great Content thanks a lo...
ReplyDeletebuy Google voice number
Twitter pva accounts
Buy Instagram pva accounts
Buy Facebook pva accounts
great contents
ReplyDelete