The syntax of the
DISTINCT clause is as follows:
DISTINCT clause is used in the
SELECT statement to remove duplicate rows from a result set. The
DISTINCT clause keeps one row for each group of duplicates. You can use the
DISTINCT clause on one or more columns of a table.
PostgreSQL DISTINCT on multiple columns
fcolorcolumns in the
SELECT DISTINCTclause, PostgreSQL combined the values in both
fcolorcolumns to evaluate the uniqueness of rows.
PostgreSQL DISTINCT ON ORDER BY example
The following statement sorts the result set by the
fcolor, and then for each group of duplicates, it keeps the first row in the returned result set.