I want to get the total number of all valid e-mail address in a database, but I also want the total to be unique e-mail addresses. Is this possible with mysql alone?
A:
You can't check if an e-mail is valid with mysql.
You can select all unique e-mail with a distinct select:
SELECT DISTINCT `e-mailadress`FROM `table1` //something like this
Tim
2010-02-11 19:57:12
A:
Something like this maybe?
SELECT `email`
FROM `users`
WHERE `email`
REGEXP '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'
GROUP BY `email`
Regex was from here. As the site points out, this may not match all valid emails (i.e. the obscure ones). The last time I looked into it I'm not sure if anyone had created a regular expression which would match every possible email address.
akiller
2010-02-11 19:58:51
Justin Johnson
2010-02-11 20:02:20
thats still not the full one, the full one is 6300+ characters long
fuzzy lollipop
2010-02-11 20:03:22
This is perfect, I didn't really think of regex. Thanks!
jwzk
2010-02-11 20:07:01
+1
A:
If you want the number of them you'd do
SELECT COUNT(DISTINCT('EMAIL')) FROM 'TABLE'
silent1mezzo
2010-02-11 20:00:40