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 aKColumn
or aKTableColumn
which will be supplied to thecount
method.countDistinct(String jdbc, KColumn kColumn)
: Receives the name of datasource connection to which you need to connect and aKColumn
or aKTableColumn
which will be supplied to thecount
method.
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