日期:2014-05-18 浏览次数:20407 次
create table table1(a varchar(2)); insert into table1 select 'h' insert into table1 select 'a' insert into table1 select 'b' insert into table1 select 'b' insert into table1 select 'c' insert into table1 select 'c' insert into table1 select 'a' insert into table1 select 'd' insert into table1 select 'd' insert into table1 select 'd' insert into table1 select 'a' ..... select a from table1; drop table table1;
select *,count(*) as total from table1 group by a having count(*)=(select max(total) from(select *,count(a) as total from table1 group by a)t) --a,d一样多 ----------- a total ---- ----------- a 3 d 3