database

Finding duplicate db entries

Supposing you have a MySQL table like this:

id
login
client
password
email
...

without a UNIQUE constraint for (login,client) – you want to find out which combinations of login and client are there more than once – use this kind of query:

SELECT login,client,count(*) as cnt
FROM yourtable
GROUP BY 1,2
HAVING cnt > 1
ORDER BY 3;

Thanks to Mike for the hint.

Tags: ,

Wednesday, July 9th, 2008 Technology No Comments

Welcome!

Have fun reading this blog. You will find some "about" data if you follow the link in the header.

Archives