This is helpful when you wanted to get multiple columns and also needed a column to be distinct
table columns
id
firstname
middlename
address
age
gender
here is the query....
SELECT
DISTINCT
ON(firstname)firstname,
lastname,
middlename,
address,
age,
gender;
hope that little code helps. : )
-