+ Start a Discussion
Rajesh SainiRajesh Saini 

Relation Between Two Custom object

HI All,
i have an question suppose i have two custom object A & B
i have a lookup 'C' on object  B of  object A
Now i want to write some SOQL like i just want to select value from object A and B which have C value that i will passed.
Shrikant BagalShrikant Bagal
Please try following Query

Object A => objectA__c
Object B => objectB__c

Relationship field On Object B:

lookupA => lookupA__c


then query will
--------------------------------------------------------------------------------------------------------------------------------------------------
SELECT Id, Name, lookupA__r.Name FROM objectB__c Where lookupA__c =: yourvalue
--------------------------------------------------------------------------------------------------------------------------------------------------

 If its helps, please mark as best answer so it will help to other who will serve same problem.
T​hanks! 
K@SK@S
Hi Rajesh,

Try to this type.

SELECT Id, FirstName__c, Mother_of_Child__r.FirstName__c
FROM Daughter__c
WHERE Mother_of_Child__r.LastName__c LIKE 'C%'

https://developer.salesforce.com/docs/atlas.enus.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships.htm

Thanks,
kae
Shrikant BagalShrikant Bagal

If its helps, please mark as best answer so it will help to other who will serve same problem.
T​hanks!