mysql subqueries


I decided to find out how many duplicate accounts exists in one of our databases and made a startling discovery about mysql sub queries.

For many years PHP scripters (and other programmers for that matter) have been using a nested loop in place of subqqueries in mysql. The enlightened decided not to bother with mysql at all and to rely on postgres instead. Not very long ago mysql finally decided to implement subqueries but it is still not all tha t prevalent because many ISP

still support older versions of mysql which does not support subqueries, foreign keys and many other features.

To get back to my problem, I reconed that if anyone had signed up using the same email twice that would be a duplicate account. This was on a Rad User Manager database that had around 1600 users at the time. I used the following query to identify duplicates.

select a.userId, b.userName, b.userPassword, a.userEmail, a.userValidated

comments powered by Disqus