In a SELECT statement, the DISTINCT keyword is used to retrieve unique values from a table.

Example

The following example illustrates a SELECT statement with the DISTINCT keyword when fetching a DDM-configured field.
SELECT DISTINCT
CustNum FROM pub.Customer;
In this example, CustNum is a DDM-configured field. Regardless of your DDM privileges, the SQL engine processes the DISTINCT keyword by retrieving the unique and unmasked values of CustNum internally. Upon retrieval, the engine then masks these values if you do not have the required unmasking privileges and returns them; otherwise, it returns unmasked and distinct values of CustNum.