SQL Server: Retrieve the duplicate value in a column

Viewed 42818

How could I filter out the duplicate value in a column with SQL syntax?

Thanks.

5 Answers

You asked for a list of the duplicates. Here is a simple way using the except operator (SQL 2008 +).

  select [column] from Table1 

    except

  select distinct [column] from Table1; 

Alternatively, you could use standard SQL

select [column] from Table1 

where [column} not in 

     (select distinct [column} from Table1);
Related