DB2 Derby Paged Select SQL分页查询语句

Categories: Database; Tagged with: ; @ October 5th, 2010 21:50

DB2 Paged Select SQL 分页:

分页举例:
SELECT * FROM (
           SELECT  DEPT.ID, DEPT.MGRNO, ROWNUMBER() OVER (ORDER BY DEPT.ID) AS NS FROM DEPT WHERE      DEPT.MGRNO > 0
  ) AS TEMP WHERE TEMP.NS BETWEEN 1 and 5;

See:

1. API: http://www.ibm.com/developerworks/data/library/techarticle/0307balani/0307balani.html
2. db2分页sql语法
3. db2排序rownumber函数讨论
4. Oracle, DB2 及 MySQL 分页查询写法

Derby Paged Select SQL 分页语句:

SELECT * FROM T ORDER BY I OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY

See: Derby 10.4之后开始支持 http://db.apache.org/derby/docs/10.5/ref/rrefsqljoffsetfetch.html

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.