设置sqlserver使用row_number时不排序
–1.看到nhibernate是这样写的分页,感觉写起来比较容易理解(应该不会有效率问题吧?)
–with只是定一个别名?
[sql]
with query as (select row_number() over(order by (select 0)) as rownum, * from product)
select * from query where rownum between 5 and 10
–2.row_number必须指写over (order by **),有时我根本就不想排序,想按原始顺序(排序也是要时间的嘛)
–方法就是:
select row_number() over(order by (select 0)) as rownum,* from product
排序 就是 :
select row_number() over(order by oper_date desc) as rownum,* from product