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

WBOY
發布: 2016-06-07 17:00:27
原創
1005 人瀏覽過

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

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板