摘要:
create proc up_GetPageData@pi int --页码@ps int --页容量asbeginselect * from (select ROW_NUMBER() over(order by id) as RNum,*from table) as tempwhere RNum>(@pi-1)*@ps and RNum<=@pi*@psend再来执行这一条语句execup_GetPageData 1,4 阅读全文
摘要:
按时间查询最近的阶段并显示5条数据:select top 5字段 from表 order by字段的时间 desc分页的高效率的语句:SELECT *from(SELECT Id, UserName, Age, Sex, IsVIP,row_number() over(order by id) rownum FROM dbo.T_USERS)twhere t.rownum>@startRowIndex and t.rownum<=@startRowIndex+@maximunRows 阅读全文