You are on page 1of 1

sql queries for count duplication: SELECT tablefield, COUNT(tablefield) AS dup_count FROM table GROUP BY tablefield HAVING (COUNT(tablefield)

> 1) SELECT * FROM table WHERE tablefield IN ( SELECT tablefield FROM table GROUP BY tablefield HAVING (COUNT(tablefield ) > 1) ) SELECT t1.* FROM towns AS t1 LEFT JOIN towns AS t2 ON t1.id != t2.id AND t1.country = t2.country AND t1.name = t2.name WHERE t2.id IS NOT NULL GROUP BY t1.id SELECT YourColumn, COUNT(*) TotalCount FROM YourTable GROUP BY YourColumn HAVING COUNT(*) > 1 ORDER BY COUNT(*) DESC Select ID from Table1 where Name IN (SELECT Name FROM Table1 GROUP BY Name HAVIN G ( COUNT(Name) > 1 ))

You might also like