------------- SQL Server 1.使用row_number分页 declare @PageSize int = 5 declare @PageIndex int = 1 select * from (select ROW_NUMBER() over(order by SId) RowId,Student.* from tblStudent) A where RowId between (@PageIndex*@PageSize+1) and (@PageIndex*@PageSize) ———— 版权声明:本文为CSDN博主「小白长虫」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/weixin_44201223/article/details/121580227 2.// x1:跳过的行数 x2:显示的行数 ORDER BY 字段 ASC/DESC offset x1 rows fetch next x2 rows only // LEN(字段名)取长度 @pageIndex:第几页 @pageLine:一页显示的条数 // 假如一页显示3条数据,查询第2页需要显示的数据,则 // ((@pageIndex - 1) * @pageLine)=(2-1)*3 @pageLine=3 ORDER BY LEN(MW.WREA_CODE),MW.WREA_CODE offset((@pageIndex - 1) * @pageLine) rows fetch next @pageLine rows only ———— 来自:https://blog.csdn.net/weixin_45659376/article/details/107336143
------------------ oracle(rownum)和MYSQL(limit)比较好分页
select * from table1 t inner join (select a from table1 order by a
offset 1 rows fetch next 2 rows only)t1 on t1.A=t.A