title: MySQL Query to Count Unique Domains from Email Address field
body: <p>I'd like to get a better idea of what domains my customers are using. I could easily do this in PHP by <code>explode</code>ing each address and counting the domain that way. But I'm wondering if there's a way to get this information with just a plain MySQL query?</p>
  
  <p>This is what sample output would look like:</p>
  
  <p><code>gmail.com | 3942</code></p>
  
  <p><code>yahoo.com | 3852</code></p>
  
  <p><code>hotmail.com | 209</code></p>
  
  <p>... and so on, where the first column is the email addresses domain, and the 2nd column is the number of addresses at that domain.</p>