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
SFDC ROCKSFDC ROCK 

how to write soql with unrelated object

How to find a__c ,b__c and c__c table from object  S and object P
if we do not have any direct relationship between both but Object O is having relationship with S and P.

SQOL Query ?
 
ANUTEJANUTEJ (Salesforce Developers) 
Hi there,

Can you try checking the below link which has a similar question, and I don't think this is possible to use soql to get unrelated objects however there is a best answer that could help you.

>> https://trailblazers.salesforce.com/answers?id=9063000000044gFAAQ

I hope this helps.

Regards,
Anutej
ANUTEJANUTEJ (Salesforce Developers) 
Aditionally I also found below link for fetching records which have a common parent: https://salesforce.stackexchange.com/questions/155222/fecthing-records-from-unrelated-objects-but-commonly-have-parent-object