Max aggregate support for both grouped & ungrouped queries