Wrap group_by sql with a subquery for limiting rows in Oracle.

Fixes #128
Merge pull request #315 from tamird/129

Wrap group_by sql with a subquery for limiting rows in Oracle.