I have an object Project__c where I have related list as Phase__c and Toll__c. Project__c is a lookup to Phase__c and Toll__c.Can i have a single soql query where i can have all the phase__c and toll__c under each project.



Use below query,

List<Project__c> lstProject=[Select id,(select id from Phases__r),(select id from Tolls__r) from Project__c];

Note - Phases & Tolls are the child relationship names. You need to update them if you have given some different child relationship names.

  • @Sid did it work? – snehakem Apr 17 '15 at 5:15

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.