Link to home
Start Free TrialLog in
Avatar of _CODER_
_CODER_

asked on

Select and display duplicates in a table

I need to write a select statement that will show all records that have the same "UserCode" in a table.
I have the below but it's only showing one of each duplicate. I need to list them out so it will show each user...
What would I write to show each duplicate so I can compare them.

SELECT UserCode, FirstName, LastName
FROM Users
WHERE UserCode is not null
GROUP BY UserCode
HAVING (COUNT(UserCode) > 1 )

ASKER CERTIFIED SOLUTION
Avatar of tigin44
tigin44
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial