add support for having clause in groupby queries