码迷,mamicode.com
首页 > 其他好文 > 详细

使用存储过程查询并按每页10条记录分页显示图书借阅纪录

时间:2016-01-02 22:21:06      阅读:446      评论:0      收藏:0      [点我收藏+]

标签:

 create procedure sp_pageing_abc
  @cur_page_num int,  -- 当前页码  
  @page_size int      -- 页码大小  传值时,这里填10
  as
  begin
      select top @page_size * from abc 
      where id<=(select isnull(min(id),0) from
      (
        select  top(@page_size*(1-1)) id from abc
        where is_borrow=1 order by id desc
      ) as t) and  is_borrow=1 order by id desc
  end
  -- 说明: 如果你不想加是否被借阅过的条件,则把where子句的条件去掉即可,但order by id desc得要保留。否则不能得到正确的结果。

 

使用存储过程查询并按每页10条记录分页显示图书借阅纪录

标签:

原文地址:http://www.cnblogs.com/annkiny/p/5095233.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!