oracle数据库里分页sql怎么写啊,要求一页显示5条,一共21页.sql应该怎么写啊
展开全部
page1:
select * from (select a.*, rownum rn from (
select *
from table_name
) A WHERE ROWNUM <= 5) WHERE RN > 0
page2:
select * from (select a.*, rownum rn from (
select *
from table_name
) A WHERE ROWNUM <= 10) WHERE RN > 5
page3:
select * from (select a.*, rownum rn from (
select *
from table_name
) A WHERE ROWNUM <= 15) WHERE RN > 10
......
page21:
select * from (select a.*, rownum rn from (
select *
from table_name
) A WHERE ROWNUM <= 105) WHERE RN > 100
翻页的话传5的倍数进去就行了
select * from (select a.*, rownum rn from (
select *
from table_name
) A WHERE ROWNUM <= 5) WHERE RN > 0
page2:
select * from (select a.*, rownum rn from (
select *
from table_name
) A WHERE ROWNUM <= 10) WHERE RN > 5
page3:
select * from (select a.*, rownum rn from (
select *
from table_name
) A WHERE ROWNUM <= 15) WHERE RN > 10
......
page21:
select * from (select a.*, rownum rn from (
select *
from table_name
) A WHERE ROWNUM <= 105) WHERE RN > 100
翻页的话传5的倍数进去就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询