How to select duplicate rows in SQL

Submitted 1 year, 1 month ago
Ticket #421
Views 175
Language SQL
Priority Low
Status In-Progress

This query will give us John, Sam, Tom, Tom because they all have the same email.

However, what I want is to get duplicates with the same email and name.

That is, I want to get "Tom", "Tom".

Submitted on Apr 27, 21
add a comment

2 Answers

This might help: FInd duplicates (

Or, maybe stackoverflow (

Submitted 1 year, 1 month ago

There are many ways to do this,

one of them below,

FROM users a
JOIN (SELECT username, email, COUNT(*)
FROM users 
GROUP BY username, email
HAVING count(*) > 1 ) b
ON a.username = b.username

Submitted 1 year, 1 month ago

Wanna Post Ad?
Reach a large group of audience by posting an ad about your business here. For more details
Drop us a Message