--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;