I had an instance where I created a lookup field on a custom object (i.e. Sale__c
) to reference an Opportunity
, in which case this created a relationship for the Opportunity. Meaning I could now SOQL any related custom objects using the plural API name and a "__r" suffix like so:
SELECT Id, (SELECT Id FROM Customs__r) FROM Opportunity
But for my scenario the question was about using this relationship the other direction. When writing a query on the custom Sale__c
object there is no relationship for me to use Opportunities__r
like so:
SELECT Id, (SELECT Id FROM Opportunities__r) FROM Sale__c