Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. SELECT substr(email,locate('@',email)+1,255) AS host,count(1) AS count
  2. FROM my_emails
  3. WHERE email like '%@%'
  4. GROUP BY substr(email,locate('@',email)+1,255)
  5. ORDER BY count(1) DESC
  6. LIMIT 10
  7.  
  8. db.my_emails.aggregate(
  9. {
  10. $group : {_id : "$host", total : { $sum : 1 }}
  11. }
  12. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement