Skip to content

egon-orm-workspace / egon-orm / countDistinct

Function: countDistinct() ​

ts
function countDistinct<X>(expr): Aggregate<number, ParamsOf<X>>;

Defined in: core/src/query/functions.ts:423

count(DISTINCT x): the number of different non-null values.

Type Parameters ​

X ​

X extends Expr<unknown, never>

Parameters ​

expr ​

X

Returns ​

Aggregate<number, ParamsOf<X>>

Example ​

ts
countDistinct(p.authorId);

Throws ​

QueryError when the argument is not an expression.