function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JamesSSJamesSS 

Sorting or highest value in in Map

I have 100 accounts of Account Object.Every account have more than one contact.I need to getting the highest contact by the contact (percent field) in every account.

Is it possible in Map?

 

Its urgent.Please help me

APathakAPathak

Hi,

Other than the aggregate query mentioned in earlier post you can use the below query :-

 

list <account> lacc = [select id,(select id from contacts order by PercentField__c DESC limit 1) from account where id in :accIDs];