The GROUP BY clause is an optional clause in SELECT statements. It groups rows based on the values of one or more fields and returns one row for each group. The SQL engine uses the unmasked values of the fields involved in the GROUP BY clause, irrespective of your DDM privileges.

Example

The following example illustrates the use of GROUP BY clause with a DDM-configured field.
SELECT State, COUNT(*)
FROM pub.Customer GROUP BY State;
If State is a DDM-configured field, the SQL engine processes the GROUP BY clause using the unmasked values of State, regardless of your DDM privileges. However, the SELECT list of the query returns unmasked values of State for authorized users and masked values for unauthorized users.