Select Distinct
The DISTINCT keyword can be used to return only distinct (unique) values. It is often used to remove duplicates from query results.
SQL Select DISTINCT Syntax:
SELECT DISTINCT
Column1,
Column2,
Column3
FROM Table_Name
Example:
Lets get the distinct ReasonTypes from the following table.
Results:
Distinct can be used with aggregates COUNT, AVG, MAX, etc.
SELECT COUNT
(DISTINCT Column1)
FROM Table_Name
Ex:
Results:
SQL Tutorial