Join
the community
Sign-up
Ask a question »

SQL - avoid duplicates in a SELECT

May 2013


[SQL] avoid duplicates in a SELECT




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

See also

Knowledge communities.

MySQL - Evitar los duplicados en un SELECT
MySQL - Evitar los duplicados en un SELECT
By Carlos-vialfa on October 12, 2010
MySQL - éviter les doublons dans un SELECT
SQL - Evitare i doppioni in SELECT
SQL - Evitare i doppioni in SELECT
By zig@ on April 2, 2010
MySQL - evitar as duplicatas em um SELECT
MySQL - evitar as duplicatas em um SELECT
By pintuda on March 20, 2012
Original article published by Jeff. Translated by jak58.
This document entitled « SQL - avoid duplicates in a SELECT » from Kioskea (en.kioskea.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.
Receive our newsletter

health.kioskea.net

Error connecting to SQL Server 2005