I need to display related opportunities in lead page with some requirements like order by unit potential and display only highest unit potential record of the opportunity.means I want to display distinct opportunity records
So I tried to use
Count_Distinct but I am not able to parse query.
How can I modify the below query to get the data I want?
Select Id,Number_of_Units__c,Name,StageName,Type,Billing_City__c,Opp_Sic_Code__c from Opportunity where Billing_City__c=:cityset AND Opp_Sic_Code__c=:Sicset AND StageName='Closed Won' ORDER BY Number_of_Units__c Desc Limit 10
I need to display only two opportunities in above scenario first one and third one,opportunity test-- & Internal.Because test-- has the highest unit potential for the account Sample and internal is related to other account