使用 row_number 进行sqlserver分页
例子:
select top 5* from (SELECT ROW_NUMBER() OVER(ORDER BY ID ASC) AS rowid,* FROM CustomerInfo) c where c.rowid > ((2-1)*5)
解说:
这种写法效率比not in 那种更高,并且出错率更低,代码看起来更加简短
例子:
select top 5* from (SELECT ROW_NUMBER() OVER(ORDER BY ID ASC) AS rowid,* FROM CustomerInfo) c where c.rowid > ((2-1)*5)
解说:
这种写法效率比not in 那种更高,并且出错率更低,代码看起来更加简短