select * from a where id in (select id,max(num) from (select id,count(content) num from a group by id) group by id);
解决方案 »
- 请教sql
- 高手留步~~ 使用SQL语句 日期和当前日期
- server2008 R2 虚拟机问题
- 数据抽样检查,抽样量大小的选择
- 高手帮忙:oracle的函数中可以使用系统内置视图(比如:dba_users)么?
- 如果我给一个job里的inveterval要设置成每2个小时发生一次,应该怎么写?
- Oracle安装问题,我的机器为什么运行不了Oracle安装文件?
- 请问关于ORACLE的服务哪个应该是启动的
- Oracle 9i的Enterprise Manager Console
- .net 连接ORACLE9i出错,很怪的问题,在线等侯...
- 很容易说明白,但很难写的SQL
- sql loader语句中的trailing nullcols是什么意思?
(select count(*) cnt,id from a group by id) where cnt=max(cnt)
;
select * from a where id in (select id from (select id,count(content) num from a group by id)
where num=(select max(num) from (select id,count(content) num from a group by id)))
here is the answer :select * from a
where id in (
select id from a group by id
having count(content) =
(select max(v.num)
from
(select id , count(content) num from a group by id) v))
select * from a,
(select c.id from (select id,sum(length(content)) as totallen from a group by id) c,(select max(totallen) as totallen from (select id,sum(length(content)) as totallen from a group by id)) d
where c.totallen=d.totallen)
b where a.id=b.id