This will not get you to SQL-foo master status, but it will help you out when trying to find duplicate rows in a database table that is, err, let's just say not-so-well-formed:

select
count(*),
min(id),
max(id),
email
from users
group by email having count(*)  > 1;

Trackback URI | Comments RSS

Leave a Reply