I am trying to query opportunities that have changed stages in a given time range. I have been trying to do it by using a subquery on the opportunityHistories and filtering based off of that, but I haven't been able to get it to work yet. I would like to use a query like:
Select id, name, quote_created__c, stagename from opportunity where (select stageName, createddate, systemmodstamp from OpportunityHistories where createddate > 2018-02-27T00:00:00.000Z and createddate < 2018-02-27T19:05:00.000Z) != null
Whenever I run this it says
Unknown error parsing query.
Is there any way to check if a subquery returns results in a where clause? Or is there a better way of searching for opportunities that have changed stage in a time range?