要第一行到第10行数据,然后我又要11行到21行地数据,就有点象分屏输出。谢谢! 方法一: select * from tablename where rownum<=10; (取1-10行)select * from tablename where rownum<=20 minus select * from tablename where rownum<=10; (取11-20行)方法二: select * from (select rownum rn,tablename.* from tablename) where rn<10; (取1-10行) select * from (select rownum rn,tablename.* from tablename) where rn>=11 and rn <=20; (取11-20行)
建议使用分许函数来处理..select col_list from ( select col_list,row_number() over (order by order_list) rn from table where .... ) where rn >= m and rn < n
select * from (select rownum rn,t1.*,t2.* from t1,t2 where t1.a=t2.a) where rn>=11 and rn <=20;
方法一:
select * from tablename where rownum<=10; (取1-10行)select * from tablename where rownum<=20
minus
select * from tablename where rownum<=10; (取11-20行)方法二:
select * from (select rownum rn,tablename.* from tablename) where rn<10; (取1-10行)
select * from (select rownum rn,tablename.* from tablename) where rn>=11 and rn <=20; (取11-20行)
from (
select col_list,row_number() over (order by order_list) rn
from table
where ....
)
where rn >= m and rn < n