withDistinctOn

fun withDistinctOn(vararg columns: Column<*>): T

Specifies that the SELECT query should retrieve distinct results based on the given list of columns.

This method can be used to set a DISTINCT ON clause for the query, which is supported by some SQL dialects (e.g., PostgreSQL, H2). The resulting query will retrieve rows that are distinct based on the specified columns.

Return

The current Query instance with the DISTINCT ON clause applied.

Parameters

columns

The columns to apply the DISTINCT ON clause.