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
Ramesh Naidu PRamesh Naidu P 

How to write Outer Join Quries in SOQL ?

How to write Outer Join Quries in SOQL ?
Always ThinkinAlways Thinkin
Ideally the outer joins are between two tables that have some relationship, even if it's just a shared parent relationship. If you must do an arbitrary join between two tables that have no relationship at all, we're forced to revert to building collections of both tables in Apex and then iterating over that map of one to join values from the other. This article, https://developer.salesforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com, describes the means of left- and right-outer joins where a relationship already exists.
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help u
http://blog.jeffdouglas.com/2010/02/22/soql-how-i-query-with-thee-let-me-count-the-ways/
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/
https://developer.salesforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com

SOQL Joins

Right Outer Join
Problem: Find job Applications and related Departments (from Applications).
Note that for this example, we would like to list applications including those which are not related to a Position yet. This is accomplished by an outer join.
SOQL Query:
SELECT Name, Position__r.Department__c FROM Job_Application__c
Left Outer Join
Problem: Find all positions with their related list of applications.
Again, we would like to list the positions regardless of whether there is a related application or not.
SOQL Query
SELECT Name, (SELECT Name FROM Job_Applications__r) FROM Position__c
Please let us know if this will help you