Reputation: 843
Consider following data in table ->
1 [email protected]
2 [email protected]
3 [email protected]
4 [email protected]
I want it to return only the following:
2 [email protected]
...and skip the duplicate values.
Upvotes: 1
Views: 499
Reputation: 343
The query you want is
SELECT id, email, whatEverColumn
FROM table
WHERE email IN (SELECT email
FROM table
GROUP BY email
HAVING COUNT(id) = 1)
Upvotes: 2