I have a table like this
mysql> desc user_changes;
+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| id | varchar(16) | NO | PRI | | |
| email | varchar(255) | YES | MUL | NULL | |
| products | longtext | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
And i need to create a query that will count all the duplicate by email like this
| 20061129180346 | test@test.com | 1^31^9
| 20061129330638 | test@test.com | 1^31^9
The last (
HAVING) clause limits the selection to email counts that are >1, e.g. duplicates.