进行分页查询时 使用了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
原文地址:https://www.cnblogs.com/UUUz/p/12023561.html