DevelopersSalesforce How to Relationship Query in Salesforce? By Amit Singh - September 26, 2023 0 656 FacebookTwitterPinterestMix Table of Contents Recap In the previous blog post, we talked about what is SOQL and how we can perform the basic SOQL in Salesforce using the Developer Console. Introduction Here in this blog post, we will talk about how we can work on the relation ship queries in Salesforce. Relationship queries are very important as we will be using these SOQLs in our day to day development duties. SOQL ContinueHAVINGHaving Count(Id) > 1Relationship queries: child-to-parentContact ( Child )AccountOpportunity ( Child )AccountCase ( Child )AccountContactRelationship queries: parent-to-childAccount (Parent)ContactOpportunityCase Watch Complete Video Assignments List All the Contact Records with Account Name, Rating, and IndustryQuery on the Account object and also query all the related Contact, Case, Order, and OpportunitiesCreate 3 Custom ObjectsAn invoice that is related to the AccountAn Invoice Line Item object that is related to the InvoiceA payment that is related to the AccountNow Query on Invoice Records to Query the Related Account Information and Also all the related Invoice Line ItemsNote: – Please create the required records for these objectsQuery All the Contact Record that does not have any Account Related ToQuery All the Contact Records that are related to Account RecordQuery All the Account Record that does not have any contactQuery All the Account Record that does have min one Contact RecordQuery the Invoice Record, its Related Account, and Account Related Parent Account RecordQuery the Invoice Line Item Record, its Related Invoice, Invoice Related Account, and Account Related Parent Account RecordWrite a SOQL Query to Show the MAX amount from the opportunityWrite a SOQL Query to identify the duplicate records by Name & EmailWrite a SOQL Query to display the count of Accounts for every Industry Resources https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_agg_functions.htmhttps://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select.htmhttps://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_examples.htm