Use the DISTINCT statement to return a unique list of values from the columns chosen within the SELECT query.  Said another way, it eliminates duplicate rows prior to returning a result. 

person table for distinct statement example
Person.Person Table

The following SQL uses DISTINCT to find a list of unique first names from all people in the ‘Persons’ table. 

SELECT DISTINCT FirstName FROM Person.Person ORDER BY FirstName
/* Answer */
SELECT DISTINCT FirstName 
FROM   Person.Person 
ORDER BY FirstName 

Check out the results, each first name is listed once.    

Here is an example using DISTINCT with two columns. 

SELECT DISTINCT FirstName, LastName FROM Person.Person ORDER BY FirstName
/* Answer */
SELECT DISTINCT FirstName, LastName 
FROM   Person.Person 
ORDER BY FirstName 

In summary, use the DISTINCT Statement to eliminate duplicate value from a result of one or more columns. 

DISTINCT Statement Resources 

To learn more about the DISTINCT keyword, check out these useful resources: 

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>