原始查詢語句spa
SELECT * FROM NASLE_WFSHH
修改成分頁查詢語句,加上 ROWNUM 列。此處爲查詢第 1 頁,每頁 9 條數據code
SELECT * FROM ( SELECT ROWNUM rn, a.* FROM NASLE_WFSHH a ) WHERE rn BETWEEN 9 * 0 + 1 AND 9 * 1
原始排序查詢語句blog
SELECT * FROM NASLE_WFSHH ORDER BY WFSJ DESC
排序分頁查詢語句,分兩步排序
1.添加 ROWNUM 列,不能在查詢時添加,它會先生成 ROWNUM 列,再按照字段排序class
SELECT ROWNUM rn, temp.* FROM ( SELECT * FROM NASLE_WFSHH ORDER BY WFSJ DESC ) temp
2.排序分頁查詢語句分頁
SELECT * FROM ( SELECT ROWNUM rn, temp.* FROM ( SELECT * FROM NASLE_WFSHH ORDER BY WFSJ DESC ) temp ) WHERE rn BETWEEN 9 * 0 + 1 AND 9 * 1