I am trying to use this line of Apex code to polulate a List.
I have a root object called Order__c, a child object called OrderDestinations__c and a grand child object called OrderDestinationItems__c. These three have Master Details relationships.
List<Order__c> orderList = [Select Id, (Select Id, (Select Id from OrderDestinationItems__r) from OrderDestinations__r) from Order__c] ;
I am getting the error “SOQL statements cannot query aggregate relationships more than 1 level from the root entity object.
My Salesforce org has API version 60. This article https://help.salesforce.com/s/articleView?id=release-notes.rn_api_soql_5level.htm&release=244&type=5 tells me that my code should work.
Please help me solve this problem.
I tried this code List<Order__c> orderList = [Select Id, (Select Id, (Select Id from OrderDestinationItems__r) from OrderDestinations__r) from Order__c] ;