根據時間條件排序,取前十條和後十條。
1、有時間欄位, 根據時間條件排序,取前十條和後十條
(1)前十條:
select * from (select * from tab_name a order by date_col )
where rownum<11;
(2)後十條:
select * from (select * from tab_name a order by date_col desc)
2、沒有時間欄位, 直接根據物理儲存順序,取前十條和後十條
select * from (select * from tab_name a order by rownum)
select * from (select * from tab_name a order by rownuml desc)
根據時間條件排序,取前十條和後十條。
1、有時間欄位, 根據時間條件排序,取前十條和後十條
(1)前十條:
select * from (select * from tab_name a order by date_col )
where rownum<11;
(2)後十條:
select * from (select * from tab_name a order by date_col desc)
where rownum<11;
2、沒有時間欄位, 直接根據物理儲存順序,取前十條和後十條
(1)前十條:
select * from (select * from tab_name a order by rownum)
where rownum<11;
(2)後十條:
select * from (select * from tab_name a order by rownuml desc)
where rownum<11;