Mysql
 sql >> Database >  >> RDS >> Mysql

Selezione di più righe massime

select
  x.Domain,
  x.No_of_users
from
  (select
    d.Domain, 
    count(d.Domain) as No_of_users
  from
    Domain d
  group by 
    d.Domain) x
where
  x.No_of_users = 
    (select
      max(x2.No_of_users)
    from
      (select
         d2.Domain,
         count(d2.Domain) as No_of_users
      from
         Domain d2
      group by 
        d2.Domain) x2)