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
Travis16Travis16 

Using SOQL to pull in a related list that is related to a parent object

So I am trying to write a Visualforce page that will show a related list of Project_Roles__c that are related to it's Parents Object Project__c. I want to show this on the opportunity object which is also a child object of Project__c. I am just not sure if this is possible and how to write the SOQL that will pick up the project ID from the Opportunity. Does this have to be a nested SOQL statement that will lookup the Project information from the Opportunity then the project Role information from the Project? 

Something like 
SELECT ID, Project_Name_2__c,
SELECT Account__c,Appointed__c,Contact__c,Project__c,Role__c FROM Project_Role__c WHERE Project__c = 'Project_Name_2__c'
FROM Opportunity

Then I can put this in a list where I can pull on Visualforce page. Sorry I am not a developer but trying to work my way through this.