only groupby and having clause are remaining, all else are done