`

SQL分页语句

SQL 
阅读更多

 

  1. select top 每页显示的记录数 * from topic where id not in  
  2.  (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc)   
  3.  order by id desc 

 

  1. with temptbl as (   
  2.   SELECT ROW_NUMBER() OVER (ORDER BY id desc)AS Row,    

  •   ...   
  • )   
  • SELECT * FROM temptbl where Row between @startIndex and @endIndex  
  • 分享到:
    评论

    相关推荐

    Global site tag (gtag.js) - Google Analytics