mysql group by email address with count

时间:2015-10-28 09:45:17

标签: mysql count group-by

我正在尝试编写一个查询 - 我在数据库上有1000个用户,并希望找到包含多个条目的用户

SELECT * , COUNT( * ) AS number 
FROM  `users` 
WHERE  `id` >309438 
GROUP BY email and `number` > 1

我不认为我在一百万英里之外..

1 个答案:

答案 0 :(得分:2)

SELECT email, COUNT(*) AS number 
FROM users 
WHERE id > 309438 
GROUP BY email 
HAVING number > 1