Use explicit 'None' grouping for the no-grouping case
The queries feature for 'no-grouping' case was fixed in 770cc9324.
This uses an explcit grouping='None' to handle that case,
in order to free up the empty grouping for the totals.
Also use an Enum to avoid magic strings in the code.