using query columns if a group_by clause is being used