
- SELECT * FROM [TABLE_NAME]
- GROUP BY [COLUMN_TO_CHECK] HAVING (COUNT([COLUMN_TO_CHECK]) > 1)
Assumed that you have a table called
users
and you'll extract items with same the same email address (if for some weird reason that you didn't include UNIQUE attribute on your columns). The code would go like this:
- SELECT * FROM `users` GROUP BY `email` HAVING (COUNT(`email`) > 1)
- SELECT * FROM `users` GROUP BY `email` HAVING (COUNT(`email`) = 1)