标签:分页 orm mgr mat 关键字 red nbsp char order by
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 <=
<if test="INCREMENT != null" >
${INCREMENT}
</if>
)
WHERE RN >
<if test="FROM != null" >
${FROM}
</if>
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
<if test="FROM != null" >
${FROM}
</if>
,
<if test="INCREMENT != null" >
${INCREMENT}
</if>
注意:oracle中RUMNUM 是特有的,注意大小的顺序,
mySQL 问题比较多,注意嵌套式查询时,要注意使用 指代名,最后一个B 必须有
标签:分页 orm mgr mat 关键字 red nbsp char order by
原文地址:http://www.cnblogs.com/xiaohu1218/p/7262564.html