Here's a quick easy query that will return all records where a given column's value appears more than once.

The trick is the 'group by' phrase, combined with the selection of the 'count(*)' value, which simply counts the records found for each match of 'Name'.

This query will return any records where the same value appears more than one time in the given column (in this case, the 'Name' column), along with the 'Counter' value showing how many times the duplicate appears.

view plain print about
1SELECT Name,count(*) as Counter
2FROM Table_Name
3GROUP BY Name
4HAVING Counter >
1