Pages

Wednesday, October 19, 2011

Query to find non unique column from a table

I have a users table that has over 10,000 registered users (from a database that I've inherited). The original code allows for multiple registrations with the same email address which I want to eliminate. 

 SELECT * FROM myTable WHERE email IN (SELECT email FROM myTABLE GROUP BY email HAVING count(email)>1)




This query resolved my problem after hours of brain storming :)
hope this will help u...

No comments:

Post a Comment