select count(id) as idcount,substring(email,(LOCATE( '@',email)+1)) from users where created < '2010-01-13 00:00:00' group by substring(email,(LOCATE( '@',email)+1)) order by idcount desc ;