Aggregate functions MAX & MIN are not supported on the “ActivityDate” field of the Task object (idea).
select Max(ActivityDate) max0, accountId from Task group by accountId
The above query will throw error field ActivityDate does not support aggregate operator MAX