View Single Post
  #8 (permalink)  
Old 07-16-2008, 09:45 AM
dandv dandv is offline
Junior Member
 
Join Date: Nov 2006
Posts: 2
dandv is on a distinguished road
Angry ANY answer. Re: Find duplicate entries in a table?

Quote:
Originally Posted by ben View Post
Let's assume we want to find duplicate emails in a 'users' table:

[sql]
SELECT id, email, count(email) FROM users GROUP BY email HAVING count(email) > 1
[/sql]
That doesn't work in PostgreSQL:
ERROR: column "users.id" must appear in the GROUP BY clause or be used in an aggregate function
Reply With Quote