SQL to see domains for email addresses

I wanted to find out which domains were on somebody’s mailing list, and used this SQL command:

SELECT count((SUBSTRING_INDEX(SUBSTR(email, INSTR(email, ‘@’) + 1),’.’,1))), (SUBSTRING_INDEX(SUBSTR(email, INSTR(email, ‘@’) + 1),’.’,1)) FROM `phplist_user_user` group by (SUBSTRING_INDEX(SUBSTR(email, INSTR(email, ‘@’) + 1),’.’,1)) where confirmed=1 and blacklisted=0 order by count(SUBSTRING_INDEX(SUBSTR(email, INSTR(email, ‘@’) + 1),’.’,1)) desc

It resulted in this list. Pretty cool!

3916 gmail
496 yahoo
442 kellyservices
256 comcast
228 hotmail
195 officeteam
179 accountemps
163 aol
115 sbcglobal
85 volt
84 att
81 adeccona
78 bellsouth
76 outlook
76 roberthalffinance
65 us
58 roberthalftechnology
57 earthlink
56 me
56 msn
53 ajilonfinance
52 roberthalfmr
51 cox
47 right
43 mail
40 icloud
40 mac