Add results grouping to query (no tests yet)