SELECT name,
COUNT(email)
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )
So if we have a tableID NAME EMAIL
1 John asd@asd.com
2 Sam asd@asd.com
3 Tom asd@asd.com
4 Bob bob@asd.com
5 Tom asd@asd.com
This query will give us John, Sam, Tom, Tom because they all have the same e-mails.But what I want, is to get duplicates with the same e-mails and names.
I want to get Tom, Tom.
ข้อมูลเพิ่มเติม
http://stackoverflow.com/questions/2594829/finding-duplicate-values-in-a-sql-table