Skip to main content
Returns the total number of rows of the expr, equivalent to count(distinct expr).

Syntax

Parameters

expr: the column or expression based on which multi_distinct_count() is performed. If expr is a column name, the column can be of any data type.

Return value

Returns a numeric value. If no rows can be found, 0 is returned. This function ignores NULL values.

Examples

Suppose there is a table named test. Query the category and supplier of each order by id.
Example 1: Count the number of distinct values in the category column.
Example 2: Count the number of distinct values in the supplier column.