MSSQL根据ID进行分页实现方法
2012-11-20 00:00
513 查看
ALTER PROCEDURE [a0919194122].[dnt_getappinvitelist] @uid int, @pageindex int, @pagesize int AS DECLARE @startRow int, @endRow int SET @startRow = (@pageIndex - 1) * @pagesize IF @pageindex = 1 BEGIN EXEC( 'SELECT TOP '+@pagesize+' [id],[typename],[appid],[type],[fromuid],[touid],[myml],[datetime],[hash] FROM [dnt_myinvite] WHERE [touid]='+@uid+' ORDER BY [id] DESC' ) END ELSE BEGIN EXEC(' SELECT TOP '+@pagesize+' [id],[typename],[appid],[type],[fromuid],[touid],[myml],[datetime],[hash] FROM [dnt_myinvite] WHERE [touid]='+@uid+' AND [id] < (SELECT MIN([id]) FROM (SELECT TOP '+@startRow+' [id] FROM [dnt_myinvite] WHERE [touid]='+@uid+' ORDER BY [id] DESC ) AS T ) ORDER BY [id] DESC ') END
相关文章推荐
- MSSQL根据ID进行分页
- spring-使用JdbcTemplate实现根据id进行查询
- excel中根据单元格背景颜色进行数据筛选(excel2003实现方法)
- php根据数据id自动生成编号的实现方法
- php调用淘宝开放API实现根据卖家昵称获取卖家店铺ID的方法
- 拼串的方式实现根据不同的字段进行分页(存储过程)
- JDBC实现数据库的几种基本操作(查询,分页查询,根据关键字进行查询以及插入数据)
- php根据数据id自动生成编号的实现方法
- PHP实现根据数组某个键值大小进行排序的方法
- python操作mongodb根据_id查询数据的实现方法
- php调用淘宝开放API实现根据卖家昵称获取卖家店铺ID的方法
- Android编程实现根据经纬度查询地址并对获取的json数据进行解析的方法
- 如何实现根据元素的id后面的编号进行样式的变化
- 通过JDBC实现对Oracle,mysql数据库的增删改查,模糊查询,查询全部,根据ID查询,分页查询,统计查询,
- 对数据进行分页显示到table中的实现方法
- MSSQL 多字段根据范围求最大值实现方法
- Ajax上传实现根据服务器端返回数据进行js处理的方法
- vuejs2.0实现分页组件使用$emit进行事件监听数据传递的方法