ensure groupby fields are added to select