I have requirement like we have existing opportunities are there.
For some accounts we have multiple opportunities are there.
And we had a requirement like some accounts have first opportunity had "Closed Lost" and reengage the same account and "Closed" the deal.So, they are created second opportunity as "Closed won".
And i am trying to update a field in account called ReWon in account level when any account meets above criteria
So we need filter accounts like first opportunity as "Closed Lost" and second opportunity as "Closed Won" based on created date.
But,for existing accounts i am unable to differentiate with in soql query.
My soql query would be
[Select id,name,AccountId,CloseDate,Type,StageName,account.Opportunity_Count__c from opportunity where Type='New Business' And Stagename='Closed Lost' ORDER BY CreatedDate];
Please let me know