If you have a table called T1, and the columns are c1, c2 and c3 then this query would show you the duplicate values.
<pre>
SELECT C1, C2, C3, count(*)
from T1
GROUP BY C1, C2, C3
HAVING COUNT(*) <> 1</pre>
Last Wiki Answer Submitted: March 15, 2010 4:17 am by Denny Cherry64,520 pts.
All Answer Wiki Contributors: Denny Cherry64,520 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
You can find the duplicates also in this way in SQL Server 2008;
WITH DUPLO
AS
(SELECT ROW_NUMBER() OVER (PARTITION BY YOUR_COLUMN_WITH_DOUBLE_VALUE ORDER BY YOUR_COLUMN_WITH_DOUBLE_VALUE) AS DUPLOID, * FROM YOURTABLE)
SELECT * FROM DUPLO
WHERE DUPLOID <> 1
Remember that you can use the ‘search’ feature of the site.
This is another question you might want to take a look at:
Fastest “get duplicates” SQL
Define a unique index (or however your RDBMS supports a unique constraint) on a column or set of columns and avoid “duplicates”
You can find the duplicates also in this way in SQL Server 2008;