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
Cesar LeonCesar Leon 

Help, I want to find the id of the parent object doing a where to the child object

I have a parent-child ObjectA(parent) and ObjectB(child), I want to find the id of the parent object doing a WHERE to the child object
 
akashdeeparoraakashdeeparora
Use field__r.id

Use __r instead of __c

Mark it as the best answer if it resolves your error.
akashdeeparoraakashdeeparora
Thats correct too. Glad you got it sorted!
Akshay_DhimanAkshay_Dhiman
Hi Cesar Leon 5, 

 Try this Soql:
 Here ObjectA__C is the field Api of look field or ObjectA is the name of look up field with parent:
 
 SELECT ObjectA__C FROM ObjectB__c WHERE ObjectA__C != Null;
 
 In other way:
 
 SELECT lookupfieldApi FROM ChildObjectApi WHERE lookupfieldApi != Null;
 
 Thanks
​Akshay