I have a User table that has a many records to 1 user relationship. I want to find all the records where the UserId’s are the same and the UserName’s are different.
for example I have tried:
SELECT UserId, UserName, count(*) FROM tblUser
GROUP BY UserId, UserName
This just gives me a list of users and how many times they have that distinct combination of UserId and UserName
so my desired output would be
UserId | UserName
----------+-----------
1111 | Bob
1111 | JoeBob
2222 | Jimmy
2222 | ILikeTurtles
1 Answer