+ Start a Discussion
pranav shah 40pranav shah 40 

Querying on lookup fields on Custom object

Hi All,

I hav 2 Objects... Object A & Object B... their is lookup relationship between 2 objects... suppose their are 10 records on object B..now i want to fetch records from Object B  on Object A by querying the fields...so thier will be list of records insertion everytime from external system.if the  record exist then insertion will happen successful otherwise it will get failed.... so how it will be done .. please suggest

Regards
Pranav Shah
Raj VakatiRaj Vakati
For child-to-parent relationships


SELECT ObjectA__r.Name, Name from ObjectB__c


parent-to-child relationships, 

SELECT Name, (SELECT Id,Name FROM ObjectB__r) FROM ObjectA__c


https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_understanding.htm