Case insensitive duplicates SQL

Posted by hdx on Stack Overflow See other posts from Stack Overflow or by hdx
Published on 2010-04-22T20:08:24Z Indexed on 2010/04/22 20:13 UTC
Read the original article Hit count: 400

Filed under:
|
|
|

So I have a users table where the user.username has many duplicates like:

username and Username and useRnAme
john and John and jOhn

That was a bug and these three records should have been only one.

I'm trying to come up with a SQL query that lists all of these cases ordered by their creation date, so ideally the result should be something like this:

username jan01
useRnAme jan02
Username jan03
john     feb01 
John     feb02
jOhn     feb03

Any suggestions will be much appreciated

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql