1SELECT name, COUNT(email)
2FROM users
3GROUP BY email
4HAVING COUNT(email) > 1
1SELECT
2 name, email, COUNT(*)
3FROM
4 users
5GROUP BY
6 name, email
7HAVING
8 COUNT(*) > 1
9
1declare @YourTable table (id int, name varchar(10), email varchar(50))
2
3INSERT @YourTable VALUES (1,'John','John-email')
4INSERT @YourTable VALUES (2,'John','John-email')
5INSERT @YourTable VALUES (3,'fred','John-email')
6INSERT @YourTable VALUES (4,'fred','fred-email')
7INSERT @YourTable VALUES (5,'sam','sam-email')
8INSERT @YourTable VALUES (6,'sam','sam-email')
9
10SELECT
11 name,email, COUNT(*) AS CountOf
12 FROM @YourTable
13 GROUP BY name,email
14 HAVING COUNT(*)>1