首页 > 其他 > 详细

分页查询

时间:2018-03-23 15:10:09      阅读:227      评论:0      收藏:0      [点我收藏+]

oracle中分页查询的基本语法:

  select *from (真正的查询) where rownum<=n;

 1 <select id="getDevCurActInfo" parameterType="java.util.HashMap" resultMap="curActMap">
 2         select * from 
 3             (
 4                 select A.*,rownum rn from 
 5                 (
 6                     select * from bsec_dev_act t where t.dev_id=#{devCurAct.devId,jdbcType=NUMERIC} and t.act_type=#{devCurAct.actType,jdbcType=VARCHAR} 
 7                     and t.act_time between to_timestamp(#{devCurAct.beginDate,jdbcType=VARCHAR},‘yyyy-mm-dd hh24:mi:ss‘)  and to_timestamp(#{devCurAct.endDate,jdbcType=VARCHAR},‘yyyy-mm-dd hh24:mi:ss‘)
 8                     order by t.act_id desc 
 9                 ) A
10             )where rn between #{pagination.startIndex} and #{pagination.endIndex}
11     </select>

 

分页查询

原文:https://www.cnblogs.com/s-d-g/p/8630114.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!