Thursday, November 25, 2010

mysql find duplicate record

I take it from here. Put in my own blog cause I keep using them
http://www.petefreitag.com/item/169.cfm

SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )

SELECT email
FROM users
GROUP BY email
HAVING ( COUNT(email) = 1 )

31 May 2011
It turns out these code was pretty awesome when I want to make a dynamic drop down selection
I can make it display unique value and sorted by most use at the top

No comments: