sql server中怎么实现分页
这篇文章将为大家详细讲解有关sql server中怎么实现分页,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
具体如下:
declare@indexint,@numintset@index=1--当前页set@num=2--单页包含的行数--分页1selecttop(@num)*fromppohdwheredoccodenotin(selecttop(@num*(@index-1))doccodefromppohdorderbydoccode)orderbydoccode--分页2selecttop(@num)*fromppohdwheredoccode>=(selectmax(doccode)from(selecttop(@num*(@index-1)+1)doccodefromppohdorderbydoccode)astb)--分页3selecttop(@num)*from(selectppohd.doccodeas'mydoccode',row_number()over(orderbydoccode)assno,*fromppohd)astbwheretb.sno>=@num*(@index-1)+1--分页4select*from(selectppohd.doccodeas'mydoccode',row_number()over(orderbydoccode)assno,*fromppohd)astbwheretb.snobetween(@num*(@index-1)+1)and(@num*@index)
关于sql server中怎么实现分页就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。