选择390到400间的10条记录 select * from ( select rownum id,tb.* from tb where rownum<400) where id>=390;
很好! 但有个问题不理解,就是 假如下如SQL语句返回记录数为7条 select ID,rownum from tUserInfo where status = 1; 为什么: select ID,rownum from tUserInfo where status = 1 and rownum < 10 ; select ID,rownum from tUserInfo where status = 1 and rownum < 4 ;是有记录返回的 而下面三个SQL语句 select ID,rownum from tUserInfo where status = 1 and rownum > 1; select ID,rownum from tUserInfo where status = 1 and (rownum > 1 and rownum < 4); select * from (select ID,rownum from tUserInfo where status = 1) where (rownum > 1 and rownum < 4) 都是没有记录返回呢?
不能用select * from tbname where rownum > n或者 select * from tbname where rownum >n and rownum <m;这样 select * from (select ID,rownum num from tUserInfo where status = 1) where (num > 1 and num < 4);
select * from ( select rownum id,tb.* from tb where rownum<400) where id>=390;
但有个问题不理解,就是
假如下如SQL语句返回记录数为7条
select ID,rownum from tUserInfo where status = 1;
为什么:
select ID,rownum from tUserInfo where status = 1 and rownum < 10 ;
select ID,rownum from tUserInfo where status = 1 and rownum < 4 ;是有记录返回的
而下面三个SQL语句
select ID,rownum from tUserInfo where status = 1 and rownum > 1;
select ID,rownum from tUserInfo where status = 1 and (rownum > 1 and rownum < 4);
select * from (select ID,rownum from tUserInfo where status = 1) where (rownum > 1 and rownum < 4)
都是没有记录返回呢?
select * from tbname where rownum >n and rownum <m;这样
select * from (select ID,rownum num from tUserInfo where status = 1) where (num > 1 and num < 4);
谢谢 bzszp(SongZip)兄弟啊,
问题解决,感谢各位的帮忙!
http://www.cnoug.org/bin/ut/threaded_show.cgi?tid=38&pid=77