首页 >数据库 >mysql教程 >Oralce分页-查询21到40条的数据

Oralce分页-查询21到40条的数据

WBOY
WBOY原创
2016-06-07 17:00:271019浏览

--Oracle 方法1SELECT * FROM (SELECT A.*, ROWNUM RN FROM (SELECT * FROM ss_custinfo) AWHERE ROWNUM lt;= 40)WHERE RN gt;=

--Oracle 方法1
SELECT * FROM
(
SELECT A.*, ROWNUM RN FROM (SELECT * FROM ss_custinfo) A
WHERE ROWNUM )
其中 RN >= 21;


--Oracle 方法2
SELECT * FROM
(
select ss.*, rownum rn from ss_custinfo ss
)
WHERE rn = 21;
 

--Oracle 方法3
SELECT * FROM
(
SELECT A.*, ROWNUM RN
FROM (SELECT * FROM ss_custinfo) A
)
WHERE RN BETWEEN 21和 40;


--sybase
select * from
(
select ss.*, row_number() over (order by cust_id desc ) as rn
from ss_custinfo ss
) temp
其中 temp.rn=21;

select * from
(
SELECT ss.*, row_number() OVER (按 cust_id 分区 ORDER BY 工资 desc) rn
FROM ss_custinfo ss
) temp
where temp.rn< ;=40 且 temp.rn>=21;

Oralce分页-查询21到40条的数据

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn