SQL - Avoid duplicates in the result of a SELECT query

November 2016




Issue


How to avoid duplicates in the results of a SQL query?

Solution

  • Simply use the DISTINCT clause and between the SELECT clause and the fields.
  • Example:
  • SELECT distinct id,name,surname FROM mytable
  • More informations available on this : Link

Related :

This document entitled « SQL - Avoid duplicates in the result of a SELECT query » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.