在写存储过程分页的过程中出现了一个异常的现场..一条分页的SQL的语句,select * from ( select a from t_userinfo order by phone) a
where rownum <=2在a中查询的结果排完序,为什么在外层不按内层的结果取值呢.. phone rownum
13856544444 2
13856544443 5
13856544443 4
where rownum <=2在a中查询的结果排完序,为什么在外层不按内层的结果取值呢.. phone rownum
13856544444 2
13856544443 5
13856544443 4
---------- --------------------
2 LOVE2008rr
4 lei
1 WZKHELLO WORLD
3 WZKHELLO WORLD
5 HELLO
6 HEIHEI已选择6行。SQL> select * from (select id,name from test order by id) a
2 where rownum=1; ID NAME
---------- --------------------
1 WZKHELLO WORLDSQL> select * from (select id,name from test order by id) a
2 where rownum<=2; ID NAME
---------- --------------------
1 WZKHELLO WORLD
2 LOVE2008rrSQL>