码迷,mamicode.com
首页 > 数据库 > 详细

Oracle 分页查询 插叙不出数据

时间:2019-12-11 17:19:56      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:use   别名   导致   rac   order   param   sele   nbsp   time   

 

 

进行分页查询时 使用了rownum关键字导致查询时查询不出数据 ,修改 给rownum字段取个别名,规避oracle关键字

select * from
(select  rownum,row_.* from
(select vil.*, c.audit_title, nvl(vil.update_time,‘0001-01-01‘) update_time2, u.user_name as user_name, prop.property_name as pname, param.description as description from hmfs_bas_village vil left join hmfs_bas_property prop on vil.property_id = prop.id left join hmfs_auth_village_audit c on c.village_id = vil.id and c.audit_state = ‘03024001‘ left join hmfs_sys_param param on vil.audit_state = param.param_value left join hmfs_auth_user u on u.id = vil.updater where 1=1 and vil.audit_state = ‘03024001‘ order by coalesce(vil.update_time, ‘0001-01-01‘) desc)
row_ )
where rownum < 20 and rownum >= 10

技术图片

 

 

 

select * from
(select rownum as rownum_,row_.* from
(select vil.*, c.audit_title, nvl(vil.update_time,‘0001-01-01‘) update_time2, u.user_name as user_name, prop.property_name as pname, param.description as description from hmfs_bas_village vil left join hmfs_bas_property prop on vil.property_id = prop.id left join hmfs_auth_village_audit c on c.village_id = vil.id and c.audit_state = ‘03024001‘ left join hmfs_sys_param param on vil.audit_state = param.param_value left join hmfs_auth_user u on u.id = vil.updater where 1=1 and vil.audit_state = ‘03024001‘ order by coalesce(vil.update_time, ‘0001-01-01‘) desc)
row_ )
where rownum_ < 20 and rownum_ >= 10

技术图片

 

Oracle 分页查询 插叙不出数据

标签:use   别名   导致   rac   order   param   sele   nbsp   time   

原文地址:https://www.cnblogs.com/UUUz/p/12023561.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!