Implemented group by clause.