Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-07 17:00:27
Original
1005 people have browsed it

--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 )
WHERE 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 AND 40;


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

select * from
(
SELECT ss.*, row_number() OVER (partition by cust_id ORDER BY salary desc) rn
FROM ss_custinfo ss
) temp
where temp.rn=21;

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template