+ Start a Discussion

Using MAX() with over 10,000 rows

Maybe I am missing something wth the new aggregrate functions, but should I be able to execute a simple query like this when the object has > 10,000 rows of data, or should I still be using the old 'order by closedate desc limit 1' syntax? Currently, I get an error saying the query rows returned is too large...



AggregateResult[] groupedResults = [Select max(closedate) maxcdate from Opportunity WHERE closedate != null]; system.debug('CheckDate' + groupedResults[0].get('maxcdate'));