首页 > 代码库 > 分页的SQL语句

分页的SQL语句

分页的SQL语句

sql="select * from (select row_number() over(orderby id) as num,* from table)as t where t.num>=@start and t.num<=@end";

分页的公式

int start=(pageIndex-1)*pageSize+1;

int end=pageIndex*pageSize;

分页的SQL语句