Skip to main content
Version: Java (Groovy)

selectDistinct

The selectDistinct method creates a new table containing all of the unique values for a set of key columns.

When the selectDistinct method is used on multiple columns, it looks for distinct sets of values in the selected columns.

Syntax

table.selectDistinct(columnNames...)

Parameters

ParameterTypeDescription
columnNamesString...

Key columns.

Returns

A new table containing all of the unique values for a set of key columns.

Examples

source = newTable(
stringCol("A", "apple", "apple", "orange", "orange", "plum", "grape"),
intCol("B", 1, 1, 2, 2, 3, 3),
)

result = source.selectDistinct("A")
source = newTable(
stringCol("A", "apple", "apple", "orange", "orange", "plum", "grape"),
intCol("B", 1, 1, 2, 2, 3, 3),
)

result = source.selectDistinct("A", "B")