当前位置:淘百问>百科问答>如何用sql语句 实现分页查询?

如何用sql语句 实现分页查询?

2023-04-06 02:02:35 编辑:join 浏览量:618

如何用sql语句 实现分页查询?

方法1:适用扮镇于 SQL Server 2000/2005SELECT TOP 页大小 *FROM table1WHERE id NOT IN ( SELECT TOP 页大小*(页数-1) id FROM table1 ORDER BY id )ORDER BY id方法2:适用于 SQL Server 2000/2005SELECT TOP 页大小 *FROM table1WHERE id > ( SELECT ISNULL(MAX(id),0) FROM ( SELECT TOP 页册缺慧大州答小*(页数-1) id FROM table1 ORDER BY id ) A )ORDER BY id方法3:适用于 SQL Server 2005SELECT TOP 页大小 * FROM ( SELECT ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,* FROM table1 ) AWHERE RowNumber > 页大小*(页数-1)

标签:sql,语句,分页

版权声明:文章由 淘百问 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.taobaiwen.com/answer/41494.html
热门文章