row_number() over()用法

      select *

        from (select t.*,

                     row_number() over(order by t.CONTRACTNOFILEID desc) rn

                from ly_publicrental_contractinfo t

               where Reconciliation = Valid

                 and (contractno = varContractNo or varContractNo is null))

       where rn between (pageIndex - 1) * pageSize and pageIndex * pageSize;

你可能感兴趣的:(row_number() over()用法)