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
BigPBigP 

I have 4 objects and i want to query them in one table and i want to know how can i do this?

Volunteer-Organization-Account-Contact
Volunteer is parent.
AnkaiahAnkaiah (Salesforce Developers) 
Hi Enea,

Organization-Account-Contact objects are childs to Volunteer object?

Thanks!!
 
BigPBigP
Hi,
Yes
AnkaiahAnkaiah (Salesforce Developers) 
Hi Enea,

try with below query.
 
List<Volunteer__c> vllist =[select id,name,(select id,name from Organization__r),(select id,name from Account__r),(select id,name from Contact__r) from Volunteer__c];

If this helps, Please mark it as best answer.

Thanks!!
mukesh guptamukesh gupta
HI Enea,

Please use below code:-
 
List<Volunteer__c> vllist =[select id,name,(select id,name from Organizations__r),(select id,name from Accounts__r),(select id,name from Contacts__r) from Volunteer__c];


if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh