ensure correct group_by columns are in the query