Category: SQL
Where are your users from? – (By SQL Email Domain)
April 19th, 2009, 1 Comment
Ever wondered who your users use as their email provider? Who are the biggest email providers of the users on your website? Luckily SQL has the answer in 1 easy step using the SUBSTRING_INDEX string function.
mysql> SELECT COUNT(*) AS Total, SUBSTRING_INDEX(email, ‘@’, -1) AS Domain FROM users GROUP BY SUBSTRING_INDEX(email, ‘@’, -1) ORDER BY COUNT(*) [...]