+ Start a Discussion

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



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];