oracle分页改写为mysql_oracle 的分页与 mySQL'的分页转化

oracle 分页:  关键字ROWNUM

SELECT

EMPNO,

ENAME,

JOB,

MGR,

HIREDATE,

SAL,

COMM,

DEPTNO

FROM

(

SELECT A.*, ROWNUM RN

FROM (SELECT EMPNO,

ENAME,

JOB,

MGR,

TO_CHAR(HIREDATE,'yyyy-MM-dd') HIREDATE,

SAL,

COMM,

DEPTNO

FROM

EMP

ORDER BY EMPNO) A

WHERE ROWNUM <=

${INCREMENT}

)

WHERE RN >

${FROM}

MySQL 的分页:关键字LIMIT

SELECT

EMPNO,ENAME, JOB, MGR, DATE_FORMAT(HIREDATE,'%Y-%c-%d') HIREDATE,SAL,COMM,DEPTNO

FROM

(

SELECT A.*

FROM (SELECT * FROM EMP_JBXX_ZS ORDER BY EMPNO ASC) A

) B

LIMIT

${FROM}

,

${INCREMENT}

注意:oracle中RUMNUM 是特有的,注意大小的顺序,

mySQL 问题比较多,注意嵌套式查询时,要注意使用 指代名,最后一个B 必须有

你可能感兴趣的:(oracle分页改写为mysql_oracle 的分页与 mySQL'的分页转化)