I'm trying to return parent opportunities that only have 1 or more related child opportunities, but I can't get my query right.
List <opportunity> oppsWithPotentialChildrenToBeUpdated = [Select id, name, stagename, (Select Id, name, stagename From Opportunities__r where stagename = 'Pre-Renewal' and type = 'Renewal') From Opportunity o where id in (Select opportunityId from Opportunities__r where stagename = 'Pre-Renewal' and type = 'Renewal') ];
Compile error at line 1 column 59 sObject type 'Opportunities__r' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
I checked the schema in eclipse, and Opportunities ought to work.... I tried Opportunities__r, Opportunities__c, and Opportunity