日期:2014-05-17  浏览次数:21160 次

where rownum <= 10条件的疑问

select rownum,row_.*, rownum jres_db_rownum_
  from (select sa.ADJUST_ID,
              sa.STAFF_CODE,
              -- sa.SERIAL_NO,
              sa.CURR_DT,
              -- sa.DEAL_TM,
               sa.SALARY_SUBJECT,
               sa.OCCUR_BALANCE,
               sa.BRANCH_NO,
               sa.TEAM_NO,
               
               sa.OP_ACCOUNT,
               sa.REMARK,
               sa.audit_status
          from sly_adjustfarerecord sa
         where 1 = 1           
         order by audit_status, curr_dt desc, branch_no) row_

如上语句的结果如下:


疑问:为什么加条件后的结果不是1上面图中的前面10条呢,然后2图中得出的结果是按照什么逻辑得出的

------解决方案--------------------
select * from (select rownum rr,row_.*, rownum jres_db_rownum_   from (select sa.ADJUST_ID,               sa.STAFF_CODE,               -- sa.SERIAL_NO,               sa.CURR_DT,               -- sa.DEAL_TM,                sa.SALARY_SUBJECT,                sa.OCCUR_BALANCE,                sa.BRANCH_NO,                sa.TEAM_NO,                                 sa.OP_ACCOUNT,                sa.REMARK,                sa.audit_status           from sly_adjustfarerecord sa    &