Select Page

Eliminating duplicate rows from result-set using PostgreSQL

  • Use the DISTINCT ON keyword in your query
  • To do a case-insensitive search do the following query
    SELECT DISTINCT ON(upper(surname)) surname FROM employees ORDER BY upper(surname)
  • This will return non-duplicate surnames.

 

Last Updated On April 07, 2018

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.