This Trailhead module gives a great example! https://developer.salesforce.com/trailhead/microsoft_dotnet/database_basics_dotnet/sql_to_soql
Basically you'll just include it as a field (SELECT ID, Name, CustomField__c, (SELECT ID, Name FROM StandardObjects) FROM MyCustomObject__c). Make sure it is plural as well and then you can reference it by saying something like List<StandardObject> = customObj.StandardObjects
I have a created a LookUp relationship between Vehicle__c (Parent custom object) and Opportunity(child standard object). Check the SOQL as an example to your requirement.
select id,CustomField__c,(select id,Amount from Opportunities__r ) from Vehicle__c
Please note "Opportunities" is the child relationship name. Let me know if need any help!
Basically you'll just include it as a field (SELECT ID, Name, CustomField__c, (SELECT ID, Name FROM StandardObjects) FROM MyCustomObject__c). Make sure it is plural as well and then you can reference it by saying something like List<StandardObject> = customObj.StandardObjects
Please check the below sample code. The below sample code display Account related contacts. Please try to check this code in the anonymous block.
Please refer the below link for more details.
http://example! https://developer.salesforce.com/trailhead/microsoft_dotnet/database_basics_dotnet/sql_to_soql
Hope this helps you!
Best Regards,
Jyothsna
I have a created a LookUp relationship between Vehicle__c (Parent custom object) and Opportunity(child standard object). Check the SOQL as an example to your requirement.
Please note "Opportunities" is the child relationship name.
Let me know if need any help!
Best Regards,
Deepthi