Friday 14 June 2013

Select rows with duplicate fields - postgres sql

The following query returns the field and count of rows in a table with duplicate data in the given field.

SELECT , 
 COUNT() AS NumOccurrences
FROM 
GROUP BY 
HAVING ( COUNT() > 1 )