回覆列表
-
1 # 使用者5998431963760
-
2 # 使用者5540256312630
(1)
select *
from (select a.*, rownum rnum
from (select id, data
from t order by id, rowid) a
)
where rnum >= 148 and rnum
或者
(2)
select *
from (select a.*, rownum rnum
from (select id, data
from t order by id, rowid) a
where rownum
where rnum >= 148;
最近在開發中同事說第(1)種效率不好,而第(2)種在只有唯一值(列)的時間才能正常排序,以前一直用第(1)種,今天同事找到如下的方式,解決了 第(2)種唯一值(列)排序的問題,如下:
(3)
select *
from (select a.*, rownum rnum
from (select id, data
from t order by id, rowid) a
where rownum
where rnum >= 148;
(1) select * from (select a.*, rownum rnum from (select id, data from t order by id, rowid) a ) where rnum >= 148 and rnum<=151; 或者 (2) select * from (select a.*, rownum rnum from (select id, data from t order by id, rowid) a where rownum <= 151 ) where rnum >= 148; 最近在開發中同事說第(1)種效率不好,而第(2)種在只有唯一值(列)的時間才能正常排序,以前一直用第(1)種,今天同事找到如下的方式,解決了 第(2)種唯一值(列)排序的問題,如下: (3) select * from (select a.*, rownum rnum from (select id, data from t order by id, rowid) a where rownum <= 151 ) where rnum >= 148;