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
Hari G SHari G S 





I have a doubt in SOQL. Can we write join queries in SOQL? If it is possible please show me a sample query.


Thanks and Regards

Hari G S

Rahul SharmaRahul Sharma

Yes we can queries with join in salesforce.

Querying Childs with parents:

Select Id, Name, (Select Id, LastName from Contacts) from Account

Querying Childs based on parent records:

Select Id, LastName from Contact where AccountId IN (Select Id, Name from Account)


for more examples view:Relationship Queries