Test group by and aggregate functions in order clause

Order clauses should allow aggregate functions on queries with group and limit clauses.