ust i am wondering why like this , and i know relationships are crazy many times in SFDC
I have a query as below and getting results :

select id,name,(select id,name from Batches__r)from Faces__c where Account__r.name='A Place' 

and i am not getting the value for this query

select id,name,(select id,name from faces__r),(select id,name from Batches__r) from Account where name='A Place' 

Relationships goes like this : Faces have master detail relationship with Account , Batches have lookup relationship with Account and Batches have master detail with Faces again

So i wanted to know exact reason why this is happening.

Thanks in advance for your help.

Thanks & Regards sfdev


At last i just tried different way as in the second query , it executes in Apex Explorer but not in Workbench and developer console correctly

and I just modified my query to retrieve

  1. select id,name from Faces__c where Account__r.name=my accountname

  2. for(Account a:accounts){ List bat=[select id,name,faces__c from batches__c where Faces__c!=null AND Faces__r.Account__r.name=:my accountName]; for(Batches__c b: bat){//my adding }


I know it's obvious, but... You know your name filter is different on each query right?

Account__r.name='A Place'


name='A Place to Store - 16243 '

Also, watch out for those trailing spaces on the second query.

  • please i am sorry but i am using same name in query and i have updated my question too.i am asking about query is not returning value , it doesn't mean about my data. – sfdev Jul 23 '15 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.