Count Distinct
Definition
The countDistinct method allows you to count the number of unique values in the column or expression of a table.
Available methods
countDistinct(KColumn kColumn): Receives aKColumnor aKTableColumnwhich will be supplied to thecountmethod.countDistinct(String jdbc, KColumn kColumn): Receives the name of datasource connection to which you need to connect and aKColumnor aKTableColumnwhich will be supplied to thecountmethod.
Example: KColumn
Java code:
final long count = languageRepository.countDistinct(
LANGUAGE.I18N_KEY
);
SQL generated:
SELECT COUNT(
DISTINCT la.i18n_key
)
FROM language la
Parameters:
- None
Example: String, KColumn
Java code:
final long count = languageRepository.countDistinct(
K.JDBC_LEGACY,
LANGUAGE.I18N_KEY
);
SQL generated:
SELECT COUNT(
DISTINCT la.i18n_key
)
FROM language la
Parameters:
- None