各位大侠,小弟想查询从1行到999行的数据,用了rownum ,sql语句如下
select distinct(phone_no),count(*) as num from KFWEB_OPERATELOG
where rownum < 1000 group by phone_no order by num;
为什么查询出来的结果只有700多行,去掉rownum < 1000 ,查询出来的数据有10000多行啊,
这个该怎么办呢,谢谢大家了!!!
------解决方案--------------------
- SQL code
select * from (select distinct(phone_no),count(*) as num from KFWEB_OPERATELOG group by phone_no order by num)where rownum < 1000;
------解决方案--------------------
oracle里要这么写
select * from
( select distinct(phone_no),count(*) as num from KFWEB_OPERATELOG
where group by phone_no order by num )
where rownum < 1000