MySQL SELECT DISTINCT
A table could hold duplicate rows. In such a case, to view only unique rows the distinct clause can be used. The DISTINCT clause allows removing duplicates from the result set. The DISTINCT clause can only be used with select statements.
The DISTINCT Clause cans through the values of the column/s specified only unique values from amongst them. Syntax :
1 |
SELECT DISTINCT ColumnName1,ColumnName2 from TableName; |
The SELECT DISTINCT * SQL syntax scans through entire rows and eliminates rows that have exactly the same contents in each column. Syntax :
1 |
SELECT DISTINCT * from TableName; |