count(distinct)

Aggregate. Returns the number of distinct rows in a group.

Syntax

count ( distinct expression )

Parameters

distinct expression

A column of any datatype, except binary.

Usage

This function counts all sets of non-NULL rows and returns an integer. Duplicates are not counted. A distinct expression is a column or another distinct expression that is counted.