Updated SQLQuery::aggregate() in order to work also with limit, groupBy ...

BUG: Updated SQLQuery::aggregate() in order to work also with limit, groupBy and orderBy