View Single Post
Old 01-11-2008, 08:50 PM   #2 (permalink)
RobertK
The Addict
Top Contributor Good Samaritan 
 
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
RobertK is on a distinguished road
Default

Um, that's what we call obfuscated code. That's really a wacky query, no offense meant. How about:
sql Code:
SELECT DISTINCT SUBSTRING(email, LOCATE('@', email)+1) AS domain FROM users ORDER BY domain

I'm not particularly good at SQL yet, so I'm not sure how you'd count users per domain. It could be group-by or a subquery as a variable name.
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
RobertK is offline  
Reply With Quote